diff options
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles')
8 files changed, 498 insertions, 498 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml index e16a6a7356..06058a427b 100644 --- a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml @@ -1,46 +1,46 @@ ----
-# file: roles/common/tasks/main.yaml
-
-- name: Ubuntu specific
- import_tasks: ubuntu_x86_64.yaml
- when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
-
-- name: Set hostname
- hostname:
- name: '{{ hostname }}'
- tags: set-hostname
-
-- name: Ensure hostname is in /etc/hosts
- lineinfile:
- path: '/etc/hosts'
- regexp: '^{{ ansible_default_ipv4.address }}.+$'
- line: '{{ ansible_default_ipv4.address }} {{ hostname }}.linuxfoundation.org'
- tags: set-hostname
-
-- name: Set sudoers
- lineinfile:
- path: '/etc/sudoers'
- state: 'present'
- regexp: '^%admin ALL='
- line: '%admin ALL=(ALL) ALL'
- validate: '/usr/sbin/visudo -cf %s'
- tags: set-sudoers
-
-- name: Set sudoers
- lineinfile:
- path: '/etc/sudoers'
- state: 'present'
- regexp: '^%sudo'
- line: '%sudo ALL=(ALL:ALL) NOPASSWD: ALL'
- validate: '/usr/sbin/visudo -cf %s'
- tags: set-sudoers
-
-- name: Copy grub file
- template:
- src: 'files/grub'
- dest: '/etc/default/grub'
- owner: 'root'
- group: 'root'
- mode: '644'
- notify: ['Update GRUB']
- tags: copy-grub
+--- +# file: roles/common/tasks/main.yaml + +- name: Ubuntu specific + import_tasks: ubuntu_x86_64.yaml + when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64' + +- name: Set hostname + hostname: + name: '{{ hostname }}' + tags: set-hostname + +- name: Ensure hostname is in /etc/hosts + lineinfile: + path: '/etc/hosts' + regexp: '^{{ ansible_default_ipv4.address }}.+$' + line: '{{ ansible_default_ipv4.address }} {{ hostname }}.linuxfoundation.org' + tags: set-hostname + +- name: Set sudoers + lineinfile: + path: '/etc/sudoers' + state: 'present' + regexp: '^%admin ALL=' + line: '%admin ALL=(ALL) ALL' + validate: '/usr/sbin/visudo -cf %s' + tags: set-sudoers + +- name: Set sudoers + lineinfile: + path: '/etc/sudoers' + state: 'present' + regexp: '^%sudo' + line: '%sudo ALL=(ALL:ALL) NOPASSWD: ALL' + validate: '/usr/sbin/visudo -cf %s' + tags: set-sudoers + +- name: Copy grub file + template: + src: 'files/grub' + dest: '/etc/default/grub' + owner: 'root' + group: 'root' + mode: '644' + notify: ['Update GRUB'] + tags: copy-grub diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml index d0f32a31cc..b6116c3690 100644 --- a/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml +++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml @@ -1,50 +1,50 @@ ----
-# file: roles/common/tasks/ubuntu_x86_64.yaml
-
-- name: Copy apt sources file
- template:
- src: 'files/apt-sources.list'
- dest: '/etc/apt/sources.list'
- tags: copy-apt-sources
-
-- name: Install python-apt
- apt:
- name: 'python-apt'
- state: 'present'
- update_cache: True
- tags: install-python-apt
-
-- name: Install git
- apt:
- name: 'git'
- state: 'present'
- update_cache: True
- tags: install-git
-
-- name: Install crudini
- apt:
- name: 'crudini'
- state: 'present'
- update_cache: True
- tags: install-crudini
-
-- name: Install expect
- apt:
- name: 'expect'
- state: 'present'
- update_cache: True
- tags: install-expect
-
-- name: Install socat
- apt:
- name: 'socat'
- state: 'present'
- update_cache: True
- tags: install-socat
-
-- name: Install qemu
- apt:
- name: 'qemu-system-x86'
- state: 'present'
- update_cache: True
- tags: install-qemu
+--- +# file: roles/common/tasks/ubuntu_x86_64.yaml + +- name: Copy apt sources file + template: + src: 'files/apt-sources.list' + dest: '/etc/apt/sources.list' + tags: copy-apt-sources + +- name: Install python-apt + apt: + name: 'python-apt' + state: 'present' + update_cache: True + tags: install-python-apt + +- name: Install git + apt: + name: 'git' + state: 'present' + update_cache: True + tags: install-git + +- name: Install crudini + apt: + name: 'crudini' + state: 'present' + update_cache: True + tags: install-crudini + +- name: Install expect + apt: + name: 'expect' + state: 'present' + update_cache: True + tags: install-expect + +- name: Install socat + apt: + name: 'socat' + state: 'present' + update_cache: True + tags: install-socat + +- name: Install qemu + apt: + name: 'qemu-system-x86' + state: 'present' + update_cache: True + tags: install-qemu diff --git a/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml index ffdbbcc860..0ecdcdba3b 100644 --- a/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml @@ -1,14 +1,14 @@ ----
-# file: roles/sut/tasks/main.yaml
-
-- name: Ubuntu specific
- import_tasks: ubuntu_x86_64.yaml
- when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
-
-- name: Copy 80-vpp.conf
- file:
- src: '/dev/null'
- dest: '/etc/sysctl.d/80-vpp.conf'
- state: 'link'
- become: yes
- tags: copy-80-vpp
+--- +# file: roles/sut/tasks/main.yaml + +- name: Ubuntu specific + import_tasks: ubuntu_x86_64.yaml + when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64' + +- name: Copy 80-vpp.conf + file: + src: '/dev/null' + dest: '/etc/sysctl.d/80-vpp.conf' + state: 'link' + become: yes + tags: copy-80-vpp diff --git a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml index f9ab901ded..6c9a839730 100644 --- a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml +++ b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml @@ -1,90 +1,90 @@ ----
-# file: roles/sut/tasks/ubuntu_x86_64.yaml
-
-- name: Install DKMS
- apt:
- name: 'dkms'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-dkms
-
-- name: Install pkg-config
- apt:
- name: 'pkg-config'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-pkg-config
-
-- name: Install libglib2.0-dev
- apt:
- name: 'libglib2.0-dev'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-libglib2.0-dev
-
-- name: Install autoconf
- apt:
- name: 'autoconf'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-autoconf
-
-- name: Install libtool
- apt:
- name: 'libtool'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-libtool
-
-- name: Install screen
- apt:
- name: 'screen'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-screen
-
-- name: Install libmbedcrypto1
- apt:
- name: 'libmbedcrypto1'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-libmbedcrypto1
-
-- name: Install libmbedtls10
- apt:
- name: 'libmbedtls10'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-libmbedtls10
-
-- name: Install libmbedx509-0
- apt:
- name: 'libmbedx509-0'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-libmbedx509-0
-
-- name: Install lxc
- apt:
- name: 'lxc'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-lxc
-
-- name: Install java
- apt:
- name: 'openjdk-8-jdk'
- state: 'present'
- update_cache: True
- become: yes
- tags: install-java
+--- +# file: roles/sut/tasks/ubuntu_x86_64.yaml + +- name: Install DKMS + apt: + name: 'dkms' + state: 'present' + update_cache: True + become: yes + tags: install-dkms + +- name: Install pkg-config + apt: + name: 'pkg-config' + state: 'present' + update_cache: True + become: yes + tags: install-pkg-config + +- name: Install libglib2.0-dev + apt: + name: 'libglib2.0-dev' + state: 'present' + update_cache: True + become: yes + tags: install-libglib2.0-dev + +- name: Install autoconf + apt: + name: 'autoconf' + state: 'present' + update_cache: True + become: yes + tags: install-autoconf + +- name: Install libtool + apt: + name: 'libtool' + state: 'present' + update_cache: True + become: yes + tags: install-libtool + +- name: Install screen + apt: + name: 'screen' + state: 'present' + update_cache: True + become: yes + tags: install-screen + +- name: Install libmbedcrypto1 + apt: + name: 'libmbedcrypto1' + state: 'present' + update_cache: True + become: yes + tags: install-libmbedcrypto1 + +- name: Install libmbedtls10 + apt: + name: 'libmbedtls10' + state: 'present' + update_cache: True + become: yes + tags: install-libmbedtls10 + +- name: Install libmbedx509-0 + apt: + name: 'libmbedx509-0' + state: 'present' + update_cache: True + become: yes + tags: install-libmbedx509-0 + +- name: Install lxc + apt: + name: 'lxc' + state: 'present' + update_cache: True + become: yes + tags: install-lxc + +- name: Install java + apt: + name: 'openjdk-8-jdk' + state: 'present' + update_cache: True + become: yes + tags: install-java diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml index 8e71800bca..54001a7272 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml @@ -1,6 +1,6 @@ ----
-# file: roles/tg/tasks/main.yaml
-
-- name: Ubuntu specific
- import_tasks: ubuntu_x86_64.yaml
- when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
+--- +# file: roles/tg/tasks/main.yaml + +- name: Ubuntu specific + import_tasks: ubuntu_x86_64.yaml + when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64' diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml index 9711b2678d..54a04685e6 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml @@ -1,9 +1,9 @@ ----
-# file: roles/tg/tasks/ubuntu_x86_64.yaml
-
-- name: Install Unzip
- apt:
- name: 'unzip'
- state: 'present'
- update_cache: True
- tags: install-unzip
+--- +# file: roles/tg/tasks/ubuntu_x86_64.yaml + +- name: Install Unzip + apt: + name: 'unzip' + state: 'present' + update_cache: True + tags: install-unzip diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml index 1774134abe..ea779c07da 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml @@ -1,101 +1,101 @@ ----
-# file: roles/tg_sut/tasks/main.yaml
-
-- name: Ubuntu specific
- import_tasks: ubuntu_x86_64.yaml
- when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
-
-- name: Copy interfaces file
- template:
- src: 'files/interfaces_physical'
- dest: '/etc/network/interfaces'
- owner: 'root'
- group: 'root'
- mode: '0644'
- tags: copy-interface-file
-
-- name: Copy sysctl file
- template:
- src: 'files/90-csit'
- dest: '/etc/sysctl.d/90-csit.conf'
- owner: 'root'
- group: 'root'
- mode: '0644'
- tags: copy-90-csit
-
-- name: Copy IRQ load balancing file
- copy:
- src: 'files/irqbalance'
- dest: '/etc/default/irqbalance'
- owner: 'root'
- group: 'root'
- mode: '0644'
- tags: copy-irq
-
-- name: Copy cpufrequtils file
- copy:
- src: 'files/cpufrequtils'
- dest: '/etc/default/cpufrequtils'
- owner: 'root'
- group: 'root'
- mode: '0644'
- tags: copy-cpufrequtils
-
-- name: Copy Python requirements file
- copy:
- src: 'files/requirements.txt'
- dest: '/tmp/requirements.txt'
- tags: copy-pip
-
-- name: Set isolcpus and pstate parameter
- lineinfile:
- path: '/etc/default/grub'
- state: 'present'
- regexp: '^GRUB_CMDLINE_LINUX='
- line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1 intel_idle.max_cstate=1 hpet=disable tsc=reliable mce=off"'
- notify: ['Update GRUB']
- tags: set-grub
-
-- name: Set ondemand service to disable
- service:
- name: 'ondemand'
- enabled: 'no'
- tags: set-ondemand
-
-- name: Install PIP requirements
- pip:
- requirements: '/tmp/requirements.txt'
- tags: install-pip
-
-- name: Load vfio-pci by default
- lineinfile:
- path: '/etc/modules'
- state: 'present'
- line: 'vfio-pci'
- tags: load-vfio-pci
-
-- name: Load msr by default
- lineinfile:
- path: '/etc/modules'
- state: 'present'
- line: 'msr'
- tags: disable-turbo-boost
-
-- name: Disable Turbo-Boost by service
- copy:
- src: 'files/disable-turbo-boost.service'
- dest: '/etc/systemd/system/disable-turbo-boost.service'
- owner: 'root'
- group: 'root'
- mode: '0644'
- when: >
- inventory_hostname in groups['skylake']
- tags: disable-turbo-boost
-
-- name: Disable Turbo-Boost by service on startup
- service:
- name: disable-turbo-boost
- enabled: yes
- when: >
- inventory_hostname in groups['skylake']
- tags: disable-turbo-boost
+--- +# file: roles/tg_sut/tasks/main.yaml + +- name: Ubuntu specific + import_tasks: ubuntu_x86_64.yaml + when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64' + +- name: Copy interfaces file + template: + src: 'files/interfaces_physical' + dest: '/etc/network/interfaces' + owner: 'root' + group: 'root' + mode: '0644' + tags: copy-interface-file + +- name: Copy sysctl file + template: + src: 'files/90-csit' + dest: '/etc/sysctl.d/90-csit.conf' + owner: 'root' + group: 'root' + mode: '0644' + tags: copy-90-csit + +- name: Copy IRQ load balancing file + copy: + src: 'files/irqbalance' + dest: '/etc/default/irqbalance' + owner: 'root' + group: 'root' + mode: '0644' + tags: copy-irq + +- name: Copy cpufrequtils file + copy: + src: 'files/cpufrequtils' + dest: '/etc/default/cpufrequtils' + owner: 'root' + group: 'root' + mode: '0644' + tags: copy-cpufrequtils + +- name: Copy Python requirements file + copy: + src: 'files/requirements.txt' + dest: '/tmp/requirements.txt' + tags: copy-pip + +- name: Set isolcpus and pstate parameter + lineinfile: + path: '/etc/default/grub' + state: 'present' + regexp: '^GRUB_CMDLINE_LINUX=' + line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1 intel_idle.max_cstate=1 hpet=disable tsc=reliable mce=off"' + notify: ['Update GRUB'] + tags: set-grub + +- name: Set ondemand service to disable + service: + name: 'ondemand' + enabled: 'no' + tags: set-ondemand + +- name: Install PIP requirements + pip: + requirements: '/tmp/requirements.txt' + tags: install-pip + +- name: Load vfio-pci by default + lineinfile: + path: '/etc/modules' + state: 'present' + line: 'vfio-pci' + tags: load-vfio-pci + +- name: Load msr by default + lineinfile: + path: '/etc/modules' + state: 'present' + line: 'msr' + tags: disable-turbo-boost + +- name: Disable Turbo-Boost by service + copy: + src: 'files/disable-turbo-boost.service' + dest: '/etc/systemd/system/disable-turbo-boost.service' + owner: 'root' + group: 'root' + mode: '0644' + when: > + inventory_hostname in groups['skylake'] + tags: disable-turbo-boost + +- name: Disable Turbo-Boost by service on startup + service: + name: disable-turbo-boost + enabled: yes + when: > + inventory_hostname in groups['skylake'] + tags: disable-turbo-boost diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml index 3c6eb10d62..f43fad1326 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml @@ -1,182 +1,182 @@ ----
-# file: roles/tg_sut/tasks/ubuntu_x86_64.yaml
-
-- name: Install python-dev
- apt:
- name: 'python-dev'
- state: 'present'
- update_cache: True
- tags: install-python-dev
-
-- name: Install python-virtualenv
- apt:
- name: 'python-virtualenv'
- state: 'present'
- update_cache: True
- tags: install-python-virtualenv
-
-- name: Install python pip
- apt:
- name: 'python-pip'
- state: 'present'
- update_cache: True
- tags: install-python-pip
-
-- name: Install libpcap-dev
- apt:
- name: 'libpcap-dev'
- state: 'present'
- update_cache: True
- tags: install-libpcap-dev
-
-- name: Install cpufrequtils
- apt:
- name: 'cpufrequtils'
- state: 'present'
- update_cache: True
- tags: install-cpufrequtils
-
-- name: Install cgroup-support
- apt:
- name: 'cgroup-bin'
- state: 'present'
- update_cache: True
- tags: install-cgroup-support
-
-- name: Install zlib1g-dev
- apt:
- name: 'zlib1g-dev'
- state: 'present'
- update_cache: True
- tags: install-zlib1g-dev
-
-- name: Install libnuma-dev
- apt:
- name: 'libnuma-dev'
- state: 'present'
- update_cache: True
- tags: install-libnuma-dev
-
-- name: Install Docker and role dependencies
- apt:
- name: "{{ item }}"
- state: "present"
- install_recommends: False
- with_items:
- - "apt-transport-https"
- - "ca-certificates"
- - "software-properties-common"
- - "cron"
- tags: install-docker
-
-- name: Install upstream APT GPG key
- apt_key:
- id: "{{ docker_apt_key }}"
- keyserver: "{{ ansible_local.core.keyserver
- if (ansible_local|d() and ansible_local.core|d() and
- ansible_local.core.keyserver)
- else 'hkp://pool.sks-keyservers.net' }}"
- state: "present"
- tags: install-docker
-
-- name: Install upstream APT repository
- apt_repository:
- repo: "{{ docker_repository }}"
- state: "present"
- update_cache: True
- tags: install-docker
-
-- name: Install Docker
- apt:
- name: "docker-{{ docker_edition }}={{ docker_apt_package_name }}"
- state: "present"
- update_cache: True
- install_recommends: False
- cache_valid_time: "{{ apt_cache_time }}"
- tags: install-docker
-
-- name: Remove Upstart config file
- file:
- path: "/etc/default/docker"
- state: "absent"
- tags: docker
-
-- name: Ensure systemd directory exists
- file:
- path: "/etc/systemd/system"
- state: "directory"
- owner: "root"
- group: "root"
- mode: "0755"
- tags: ensure-docker
-
-- name: Copy systemd unit file
- template:
- src: "templates/docker.service.j2"
- dest: "/etc/systemd/system/docker.service"
- owner: "root"
- group: "root"
- mode: "0644"
- register: docker_register_systemd_service
- tags: copy-docker
-
-- name: Reload systemd daemon
- command: "systemctl daemon-reload"
- notify: ["Restart Docker"]
- when: (docker_register_systemd_service and
- docker_register_systemd_service | changed)
- tags: restart-docker
-
-- name: Set specific users to "docker" group
- user:
- name: "{{ item }}"
- groups: "docker"
- append: True
- with_items: "{{ docker_users }}"
- when: docker_users
- tags: set-docker
-
-- name: Install upstream APT GPG key
- apt_key:
- id: "{{ kubernetes_apt_key }}"
- keyserver: "{{ ansible_local.core.keyserver
- if (ansible_local|d() and ansible_local.core|d() and
- ansible_local.core.keyserver)
- else 'hkp://pool.sks-keyservers.net' }}"
- state: "present"
- tags: install-kubernetes
-
-- name: Install upstream APT repository
- apt_repository:
- repo: "{{ kubernetes_repository }}"
- state: "present"
- update_cache: True
- tags: install-kubernetes
-
-- name: Install kubeadm
- apt:
- name: "kubeadm={{ kubernetes_apt_package_name }}"
- state: "present"
- update_cache: True
- install_recommends: False
- cache_valid_time: "{{ apt_cache_time }}"
- tags: install-kubernetes
-
-- name: Install kubectl
- apt:
- name: "kubectl={{ kubernetes_apt_package_name }}"
- state: "present"
- update_cache: True
- install_recommends: False
- cache_valid_time: "{{ apt_cache_time }}"
- tags: install-kubernetes
-
-- name: Install kubelet
- apt:
- name: "kubelet={{ kubernetes_apt_package_name }}"
- state: "present"
- update_cache: True
- install_recommends: False
- cache_valid_time: "{{ apt_cache_time }}"
- tags: install-kubernetes
-
+--- +# file: roles/tg_sut/tasks/ubuntu_x86_64.yaml + +- name: Install python-dev + apt: + name: 'python-dev' + state: 'present' + update_cache: True + tags: install-python-dev + +- name: Install python-virtualenv + apt: + name: 'python-virtualenv' + state: 'present' + update_cache: True + tags: install-python-virtualenv + +- name: Install python pip + apt: + name: 'python-pip' + state: 'present' + update_cache: True + tags: install-python-pip + +- name: Install libpcap-dev + apt: + name: 'libpcap-dev' + state: 'present' + update_cache: True + tags: install-libpcap-dev + +- name: Install cpufrequtils + apt: + name: 'cpufrequtils' + state: 'present' + update_cache: True + tags: install-cpufrequtils + +- name: Install cgroup-support + apt: + name: 'cgroup-bin' + state: 'present' + update_cache: True + tags: install-cgroup-support + +- name: Install zlib1g-dev + apt: + name: 'zlib1g-dev' + state: 'present' + update_cache: True + tags: install-zlib1g-dev + +- name: Install libnuma-dev + apt: + name: 'libnuma-dev' + state: 'present' + update_cache: True + tags: install-libnuma-dev + +- name: Install Docker and role dependencies + apt: + name: "{{ item }}" + state: "present" + install_recommends: False + with_items: + - "apt-transport-https" + - "ca-certificates" + - "software-properties-common" + - "cron" + tags: install-docker + +- name: Install upstream APT GPG key + apt_key: + id: "{{ docker_apt_key }}" + keyserver: "{{ ansible_local.core.keyserver + if (ansible_local|d() and ansible_local.core|d() and + ansible_local.core.keyserver) + else 'hkp://pool.sks-keyservers.net' }}" + state: "present" + tags: install-docker + +- name: Install upstream APT repository + apt_repository: + repo: "{{ docker_repository }}" + state: "present" + update_cache: True + tags: install-docker + +- name: Install Docker + apt: + name: "docker-{{ docker_edition }}={{ docker_apt_package_name }}" + state: "present" + update_cache: True + install_recommends: False + cache_valid_time: "{{ apt_cache_time }}" + tags: install-docker + +- name: Remove Upstart config file + file: + path: "/etc/default/docker" + state: "absent" + tags: docker + +- name: Ensure systemd directory exists + file: + path: "/etc/systemd/system" + state: "directory" + owner: "root" + group: "root" + mode: "0755" + tags: ensure-docker + +- name: Copy systemd unit file + template: + src: "templates/docker.service.j2" + dest: "/etc/systemd/system/docker.service" + owner: "root" + group: "root" + mode: "0644" + register: docker_register_systemd_service + tags: copy-docker + +- name: Reload systemd daemon + command: "systemctl daemon-reload" + notify: ["Restart Docker"] + when: (docker_register_systemd_service and + docker_register_systemd_service | changed) + tags: restart-docker + +- name: Set specific users to "docker" group + user: + name: "{{ item }}" + groups: "docker" + append: True + with_items: "{{ docker_users }}" + when: docker_users + tags: set-docker + +- name: Install upstream APT GPG key + apt_key: + id: "{{ kubernetes_apt_key }}" + keyserver: "{{ ansible_local.core.keyserver + if (ansible_local|d() and ansible_local.core|d() and + ansible_local.core.keyserver) + else 'hkp://pool.sks-keyservers.net' }}" + state: "present" + tags: install-kubernetes + +- name: Install upstream APT repository + apt_repository: + repo: "{{ kubernetes_repository }}" + state: "present" + update_cache: True + tags: install-kubernetes + +- name: Install kubeadm + apt: + name: "kubeadm={{ kubernetes_apt_package_name }}" + state: "present" + update_cache: True + install_recommends: False + cache_valid_time: "{{ apt_cache_time }}" + tags: install-kubernetes + +- name: Install kubectl + apt: + name: "kubectl={{ kubernetes_apt_package_name }}" + state: "present" + update_cache: True + install_recommends: False + cache_valid_time: "{{ apt_cache_time }}" + tags: install-kubernetes + +- name: Install kubelet + apt: + name: "kubelet={{ kubernetes_apt_package_name }}" + state: "present" + update_cache: True + install_recommends: False + cache_valid_time: "{{ apt_cache_time }}" + tags: install-kubernetes + |