Resolve ansible-lint name errors (#10253)

* project: fix ansible-lint name

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

* project: ignore jinja template error in names

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

* project: capitalize ansible name

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

* project: update notify after name capitalization

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

---------

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
This commit is contained in:
Arthur Outhenin-Chalandre
2023-07-26 16:36:22 +02:00
committed by GitHub
parent b9e3861385
commit 36e5d742dc
162 changed files with 842 additions and 675 deletions

View File

@@ -1,5 +1,5 @@
---
- name: containerd-common | check if fedora coreos
- name: Containerd-common | check if fedora coreos
stat:
path: /run/ostree-booted
get_attributes: no
@@ -7,11 +7,11 @@
get_mime: no
register: ostree
- name: containerd-common | set is_ostree
- name: Containerd-common | set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"
- name: containerd-common | gather os specific variables
- name: Containerd-common | gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- files:

View File

@@ -1,5 +1,5 @@
---
- name: restart containerd
- name: Restart containerd
command: /bin/true
notify:
- Containerd | restart containerd

View File

@@ -12,7 +12,8 @@
- role: adduser
user: "{{ addusers.kube }}"
tasks:
- include_tasks: "../../../../download/tasks/download_file.yml"
- name: Download CNI
include_tasks: "../../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cni) }}"

View File

@@ -5,33 +5,33 @@
when:
- not (allow_unsupported_distribution_setup | default(false)) and (ansible_distribution not in containerd_supported_distributions)
- name: containerd | Remove any package manager controlled containerd package
- name: Containerd | Remove any package manager controlled containerd package
package:
name: "{{ containerd_package }}"
state: absent
when:
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))
- name: containerd | Remove containerd repository
- name: Containerd | Remove containerd repository
file:
path: "{{ yum_repo_dir }}/containerd.repo"
state: absent
when:
- ansible_os_family in ['RedHat']
- name: containerd | Remove containerd repository
- name: Containerd | Remove containerd repository
apt_repository:
repo: "{{ item }}"
state: absent
with_items: "{{ containerd_repo_info.repos }}"
when: ansible_pkg_mgr == 'apt'
- name: containerd | Download containerd
- name: Containerd | Download containerd
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.containerd) }}"
- name: containerd | Unpack containerd archive
- name: Containerd | Unpack containerd archive
unarchive:
src: "{{ downloads.containerd.dest }}"
dest: "{{ containerd_bin_dir }}"
@@ -39,9 +39,9 @@
remote_src: yes
extra_opts:
- --strip-components=1
notify: restart containerd
notify: Restart containerd
- name: containerd | Remove orphaned binary
- name: Containerd | Remove orphaned binary
file:
path: "/usr/bin/{{ item }}"
state: absent
@@ -56,14 +56,14 @@
- containerd-shim-runc-v2
- ctr
- name: containerd | Generate systemd service for containerd
- name: Containerd | Generate systemd service for containerd
template:
src: containerd.service.j2
dest: /etc/systemd/system/containerd.service
mode: 0644
notify: restart containerd
notify: Restart containerd
- name: containerd | Ensure containerd directories exist
- name: Containerd | Ensure containerd directories exist
file:
dest: "{{ item }}"
state: directory
@@ -76,50 +76,51 @@
- "{{ containerd_storage_dir }}"
- "{{ containerd_state_dir }}"
- name: containerd | Write containerd proxy drop-in
- name: Containerd | Write containerd proxy drop-in
template:
src: http-proxy.conf.j2
dest: "{{ containerd_systemd_dir }}/http-proxy.conf"
mode: 0644
notify: restart containerd
notify: Restart containerd
when: http_proxy is defined or https_proxy is defined
- name: containerd | Generate default base_runtime_spec
- name: Containerd | Generate default base_runtime_spec
register: ctr_oci_spec
command: "{{ containerd_bin_dir }}/ctr oci spec"
check_mode: false
changed_when: false
- name: containerd | Store generated default base_runtime_spec
- name: Containerd | Store generated default base_runtime_spec
set_fact:
containerd_default_base_runtime_spec: "{{ ctr_oci_spec.stdout | from_json }}"
- name: containerd | Write base_runtime_specs
- name: Containerd | Write base_runtime_specs
copy:
content: "{{ item.value }}"
dest: "{{ containerd_cfg_dir }}/{{ item.key }}"
owner: "root"
mode: 0644
with_dict: "{{ containerd_base_runtime_specs | default({}) }}"
notify: restart containerd
notify: Restart containerd
- name: containerd | Copy containerd config file
- name: Containerd | Copy containerd config file
template:
src: config.toml.j2
dest: "{{ containerd_cfg_dir }}/config.toml"
owner: "root"
mode: 0640
notify: restart containerd
notify: Restart containerd
- block:
- name: containerd Create registry directories
- name: Containerd | Configure containerd registries
block:
- name: Containerd Create registry directories
file:
path: "{{ containerd_cfg_dir }}/certs.d/{{ item.key }}"
state: directory
mode: 0755
recurse: true
with_dict: "{{ containerd_insecure_registries }}"
- name: containerd Write hosts.toml file
- name: Containerd Write hosts.toml file
blockinfile:
path: "{{ containerd_cfg_dir }}/certs.d/{{ item.key }}/hosts.toml"
mode: 0640
@@ -134,10 +135,10 @@
# you can sometimes end up in a state where everything is installed
# but containerd was not started / enabled
- name: containerd | Flush handlers
- name: Containerd | Flush handlers
meta: flush_handlers
- name: containerd | Ensure containerd is started and enabled
- name: Containerd | Ensure containerd is started and enabled
systemd:
name: containerd
daemon_reload: yes

View File

@@ -1,5 +1,5 @@
---
- name: containerd | Remove containerd repository for RedHat os family
- name: Containerd | Remove containerd repository for RedHat os family
file:
path: "{{ yum_repo_dir }}/containerd.repo"
state: absent
@@ -8,7 +8,7 @@
tags:
- reset_containerd
- name: containerd | Remove containerd repository for Debian os family
- name: Containerd | Remove containerd repository for Debian os family
apt_repository:
repo: "{{ item }}"
state: absent
@@ -17,7 +17,7 @@
tags:
- reset_containerd
- name: containerd | Stop containerd service
- name: Containerd | Stop containerd service
service:
name: containerd
daemon_reload: true
@@ -26,7 +26,7 @@
tags:
- reset_containerd
- name: containerd | Remove configuration files
- name: Containerd | Remove configuration files
file:
path: "{{ item }}"
state: absent

View File

@@ -1,35 +1,35 @@
---
- name: restart and enable cri-dockerd
- name: Restart and enable cri-dockerd
command: /bin/true
notify:
- cri-dockerd | reload systemd
- cri-dockerd | restart docker.service
- cri-dockerd | reload cri-dockerd.socket
- cri-dockerd | reload cri-dockerd.service
- cri-dockerd | enable cri-dockerd service
- Cri-dockerd | reload systemd
- Cri-dockerd | restart docker.service
- Cri-dockerd | reload cri-dockerd.socket
- Cri-dockerd | reload cri-dockerd.service
- Cri-dockerd | enable cri-dockerd service
- name: cri-dockerd | reload systemd
- name: Cri-dockerd | reload systemd
systemd:
name: cri-dockerd
daemon_reload: true
masked: no
- name: cri-dockerd | restart docker.service
- name: Cri-dockerd | restart docker.service
service:
name: docker.service
state: restarted
- name: cri-dockerd | reload cri-dockerd.socket
- name: Cri-dockerd | reload cri-dockerd.socket
service:
name: cri-dockerd.socket
state: restarted
- name: cri-dockerd | reload cri-dockerd.service
- name: Cri-dockerd | reload cri-dockerd.service
service:
name: cri-dockerd.service
state: restarted
- name: cri-dockerd | enable cri-dockerd service
- name: Cri-dockerd | enable cri-dockerd service
service:
name: cri-dockerd.service
enabled: yes

View File

@@ -8,7 +8,8 @@
- role: adduser
user: "{{ addusers.kube }}"
tasks:
- include_tasks: "../../../../download/tasks/download_file.yml"
- name: Download CNI
include_tasks: "../../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cni) }}"

View File

@@ -1,5 +1,5 @@
---
- name: runc | Download cri-dockerd binary
- name: Runc | Download cri-dockerd binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cri_dockerd) }}"
@@ -11,7 +11,7 @@
mode: 0755
remote_src: true
notify:
- restart and enable cri-dockerd
- Restart and enable cri-dockerd
- name: Generate cri-dockerd systemd unit files
template:
@@ -22,7 +22,7 @@
- cri-dockerd.service
- cri-dockerd.socket
notify:
- restart and enable cri-dockerd
- Restart and enable cri-dockerd
- name: Flush handlers
meta: flush_handlers

View File

@@ -1,5 +1,5 @@
---
- name: restart crio
- name: Restart crio
command: /bin/true
notify:
- CRI-O | reload systemd

View File

@@ -12,7 +12,8 @@
- role: adduser
user: "{{ addusers.kube }}"
tasks:
- include_tasks: "../../../../download/tasks/download_file.yml"
- name: Download CNI
include_tasks: "../../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cni) }}"

View File

@@ -109,7 +109,7 @@
- 1.23
- 1.24
- name: cri-o | remove installed packages
- name: Cri-o | remove installed packages
package:
name: "{{ item }}"
state: absent

View File

@@ -1,5 +1,5 @@
---
- name: cri-o | check if fedora coreos
- name: Cri-o | check if fedora coreos
stat:
path: /run/ostree-booted
get_attributes: no
@@ -7,48 +7,48 @@
get_mime: no
register: ostree
- name: cri-o | set is_ostree
- name: Cri-o | set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"
- name: cri-o | get ostree version
- name: Cri-o | get ostree version
shell: "set -o pipefail && rpm-ostree --version | awk -F\\' '/Version/{print $2}'"
args:
executable: /bin/bash
register: ostree_version
when: is_ostree
- name: cri-o | Download cri-o
- name: Cri-o | Download cri-o
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.crio) }}"
- name: cri-o | special handling for amazon linux
- name: Cri-o | special handling for amazon linux
import_tasks: "setup-amazon.yaml"
when: ansible_distribution in ["Amazon"]
- name: cri-o | clean up reglacy repos
- name: Cri-o | clean up reglacy repos
import_tasks: "cleanup.yaml"
- name: cri-o | build a list of crio runtimes with Katacontainers runtimes
- name: Cri-o | build a list of crio runtimes with Katacontainers runtimes
set_fact:
crio_runtimes: "{{ crio_runtimes + kata_runtimes }}"
when:
- kata_containers_enabled
- name: cri-o | build a list of crio runtimes with crun runtime
- name: Cri-o | build a list of crio runtimes with crun runtime
set_fact:
crio_runtimes: "{{ crio_runtimes + [crun_runtime] }}"
when:
- crun_enabled
- name: cri-o | build a list of crio runtimes with youki runtime
- name: Cri-o | build a list of crio runtimes with youki runtime
set_fact:
crio_runtimes: "{{ crio_runtimes + [youki_runtime] }}"
when:
- youki_enabled
- name: cri-o | make sure needed folders exist in the system
- name: Cri-o | make sure needed folders exist in the system
with_items:
- /etc/crio
- /etc/containers
@@ -58,21 +58,21 @@
state: directory
mode: 0755
- name: cri-o | install cri-o config
- name: Cri-o | install cri-o config
template:
src: crio.conf.j2
dest: /etc/crio/crio.conf
mode: 0644
register: config_install
- name: cri-o | install config.json
- name: Cri-o | install config.json
template:
src: config.json.j2
dest: /etc/crio/config.json
mode: 0644
register: reg_auth_install
- name: cri-o | copy binaries
- name: Cri-o | copy binaries
copy:
src: "{{ local_release_dir }}/cri-o/bin/{{ item }}"
dest: "{{ bin_dir }}/{{ item }}"
@@ -80,48 +80,48 @@
remote_src: true
with_items:
- "{{ crio_bin_files }}"
notify: restart crio
notify: Restart crio
- name: cri-o | copy service file
- name: Cri-o | copy service file
copy:
src: "{{ local_release_dir }}/cri-o/contrib/crio.service"
dest: /etc/systemd/system/crio.service
mode: 0755
remote_src: true
notify: restart crio
notify: Restart crio
- name: cri-o | update the bin dir for crio.service file
- name: Cri-o | update the bin dir for crio.service file
replace:
dest: /etc/systemd/system/crio.service
regexp: "/usr/local/bin/crio"
replace: "{{ bin_dir }}/crio"
notify: restart crio
notify: Restart crio
- name: cri-o | copy default policy
- name: Cri-o | copy default policy
copy:
src: "{{ local_release_dir }}/cri-o/contrib/policy.json"
dest: /etc/containers/policy.json
mode: 0755
remote_src: true
notify: restart crio
notify: Restart crio
- name: cri-o | copy mounts.conf
- name: Cri-o | copy mounts.conf
copy:
src: mounts.conf
dest: /etc/containers/mounts.conf
mode: 0644
when:
- ansible_os_family == 'RedHat'
notify: restart crio
notify: Restart crio
- name: cri-o | create directory for oci hooks
- name: Cri-o | create directory for oci hooks
file:
path: /etc/containers/oci/hooks.d
state: directory
owner: root
mode: 0755
- name: cri-o | set overlay driver
- name: Cri-o | set overlay driver
community.general.ini_file:
dest: /etc/containers/storage.conf
section: storage
@@ -135,7 +135,7 @@
value: '"/var/lib/containers/storage"'
# metacopy=on is available since 4.19 and was backported to RHEL 4.18 kernel
- name: cri-o | set metacopy mount options correctly
- name: Cri-o | set metacopy mount options correctly
community.general.ini_file:
dest: /etc/containers/storage.conf
section: storage.options.overlay
@@ -143,37 +143,37 @@
value: '{{ ''"nodev"'' if ansible_kernel is version_compare(("4.18" if ansible_os_family == "RedHat" else "4.19"), "<") else ''"nodev,metacopy=on"'' }}'
mode: 0644
- name: cri-o | create directory registries configs
- name: Cri-o | create directory registries configs
file:
path: /etc/containers/registries.conf.d
state: directory
owner: root
mode: 0755
- name: cri-o | write registries configs
- name: Cri-o | write registries configs
template:
src: registry.conf.j2
dest: "/etc/containers/registries.conf.d/10-{{ item.prefix | default(item.location) | regex_replace(':', '_') }}.conf"
mode: 0644
loop: "{{ crio_registries }}"
notify: restart crio
notify: Restart crio
- name: cri-o | configure unqualified registry settings
- name: Cri-o | configure unqualified registry settings
template:
src: unqualified.conf.j2
dest: "/etc/containers/registries.conf.d/01-unqualified.conf"
mode: 0644
notify: restart crio
notify: Restart crio
- name: cri-o | write cri-o proxy drop-in
- name: Cri-o | write cri-o proxy drop-in
template:
src: http-proxy.conf.j2
dest: /etc/systemd/system/crio.service.d/http-proxy.conf
mode: 0644
notify: restart crio
notify: Restart crio
when: http_proxy is defined or https_proxy is defined
- name: cri-o | configure the uid/gid space for user namespaces
- name: Cri-o | configure the uid/gid space for user namespaces
lineinfile:
path: '{{ item.path }}'
line: '{{ item.entry }}'
@@ -187,7 +187,7 @@
loop_control:
label: '{{ item.path }}'
- name: cri-o | ensure crio service is started and enabled
- name: Cri-o | ensure crio service is started and enabled
service:
name: crio
daemon_reload: true
@@ -195,7 +195,7 @@
state: started
register: service_start
- name: cri-o | trigger service restart only when needed
- name: Cri-o | trigger service restart only when needed
service:
name: crio
state: restarted
@@ -203,7 +203,7 @@
- config_install.changed or reg_auth_install.changed
- not service_start.changed
- name: cri-o | verify that crio is running
- name: Cri-o | verify that crio is running
command: "{{ bin_dir }}/crio-status info"
register: get_crio_info
until: get_crio_info is succeeded

View File

@@ -1,5 +1,5 @@
---
- name: crictl | Download crictl
- name: Crictl | Download crictl
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.crictl) }}"

View File

@@ -1,3 +1,3 @@
---
- name: install crictl
- name: Install crictl
include_tasks: crictl.yml

View File

@@ -1,5 +1,5 @@
---
- name: crun | Download crun binary
- name: Crun | Download crun binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.crun) }}"

View File

@@ -1,18 +1,18 @@
---
- name: docker-storage-setup | install git and make
- name: Docker-storage-setup | install git and make
with_items: [git, make]
package:
pkg: "{{ item }}"
state: present
- name: docker-storage-setup | docker-storage-setup sysconfig template
- name: Docker-storage-setup | docker-storage-setup sysconfig template
template:
src: docker-storage-setup.j2
dest: /etc/sysconfig/docker-storage-setup
mode: 0644
- name: docker-storage-override-directory | docker service storage-setup override dir
- name: Docker-storage-override-directory | docker service storage-setup override dir
file:
dest: /etc/systemd/system/docker.service.d
mode: 0755
@@ -20,7 +20,7 @@
group: root
state: directory
- name: docker-storage-override | docker service storage-setup override file
- name: Docker-storage-override | docker service storage-setup override file
copy:
dest: /etc/systemd/system/docker.service.d/override.conf
content: |-
@@ -33,12 +33,12 @@
mode: 0644
# https://docs.docker.com/engine/installation/linux/docker-ce/centos/#install-using-the-repository
- name: docker-storage-setup | install lvm2
- name: Docker-storage-setup | install lvm2
package:
name: lvm2
state: present
- name: docker-storage-setup | install and run container-storage-setup
- name: Docker-storage-setup | install and run container-storage-setup
become: yes
script: |
install_container_storage_setup.sh \

View File

@@ -1,5 +1,5 @@
---
- name: restart docker
- name: Restart docker
command: /bin/true
notify:
- Docker | reload systemd

View File

@@ -1,5 +1,5 @@
---
- name: check if fedora coreos
- name: Check if fedora coreos
stat:
path: /run/ostree-booted
get_attributes: no
@@ -7,18 +7,18 @@
get_mime: no
register: ostree
- name: set is_ostree
- name: Set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"
- name: set docker_version for openEuler
- name: Set docker_version for openEuler
set_fact:
docker_version: '19.03'
when: ansible_distribution == "openEuler"
tags:
- facts
- name: gather os specific variables
- name: Gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
@@ -44,14 +44,16 @@
msg: "SUSE distributions always install Docker from the distro repos"
when: ansible_pkg_mgr == 'zypper'
- include_tasks: set_facts_dns.yml
- name: Gather DNS facts
include_tasks: set_facts_dns.yml
when: dns_mode != 'none' and resolvconf_mode == 'docker_dns'
tags:
- facts
- import_tasks: pre-upgrade.yml
- name: Pre-upgrade docker
import_tasks: pre-upgrade.yml
- name: ensure docker-ce repository public key is installed
- name: Ensure docker-ce repository public key is installed
apt_key:
id: "{{ item }}"
url: "{{ docker_repo_key_info.url }}"
@@ -64,7 +66,7 @@
environment: "{{ proxy_env }}"
when: ansible_pkg_mgr == 'apt'
- name: ensure docker-ce repository is enabled
- name: Ensure docker-ce repository is enabled
apt_repository:
repo: "{{ item }}"
state: present
@@ -99,7 +101,7 @@
- docker-ce
- docker-ce-cli
- name: ensure docker packages are installed
- name: Ensure docker packages are installed
package:
name: "{{ docker_package_info.pkgs }}"
state: "{{ docker_package_info.state | default('present') }}"
@@ -117,7 +119,7 @@
until: docker_task_result is succeeded
retries: 4
delay: "{{ retry_stagger | d(3) }}"
notify: restart docker
notify: Restart docker
when:
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
- not is_ostree
@@ -135,9 +137,9 @@
- docker-ce
- docker-ce-cli
- name: ensure docker started, remove our config if docker start failed and try again
- name: Ensure docker started, remove our config if docker start failed and try again
block:
- name: ensure service is started if docker packages are already present
- name: Ensure service is started if docker packages are already present
service:
name: docker
state: started
@@ -145,7 +147,7 @@
rescue:
- debug: # noqa name[missing]
msg: "Docker start failed. Try to remove our config"
- name: remove kubespray generated config
- name: Remove kubespray generated config
file:
path: "{{ item }}"
state: absent
@@ -154,13 +156,14 @@
- /etc/systemd/system/docker.service.d/docker-options.conf
- /etc/systemd/system/docker.service.d/docker-dns.conf
- /etc/systemd/system/docker.service.d/docker-orphan-cleanup.conf
notify: restart docker
notify: Restart docker
- name: flush handlers so we can wait for docker to come up
- name: Flush handlers so we can wait for docker to come up
meta: flush_handlers
# Install each plugin using a looped include to make error handling in the included task simpler.
- include_tasks: docker_plugin.yml
- name: Install docker plugin
include_tasks: docker_plugin.yml
loop: "{{ docker_plugins }}"
loop_control:
loop_var: docker_plugin
@@ -168,7 +171,7 @@
- name: Set docker systemd config
import_tasks: systemd.yml
- name: ensure docker service is started and enabled
- name: Ensure docker service is started and enabled
service:
name: "{{ item }}"
enabled: yes

View File

@@ -21,7 +21,7 @@
ignore_errors: true # noqa ignore-errors
when: docker_packages_list | length>0
- name: reset | remove all containers
- name: Reset | remove all containers
shell: "set -o pipefail && {{ docker_bin_dir }}/docker ps -aq | xargs -r docker rm -fv"
args:
executable: /bin/bash

View File

@@ -1,23 +1,23 @@
---
- name: set dns server for docker
- name: Set dns server for docker
set_fact:
docker_dns_servers: "{{ dns_servers }}"
- name: show docker_dns_servers
- name: Show docker_dns_servers
debug:
msg: "{{ docker_dns_servers }}"
- name: add upstream dns servers
- name: Add upstream dns servers
set_fact:
docker_dns_servers: "{{ docker_dns_servers + upstream_dns_servers | default([]) }}"
when: dns_mode in ['coredns', 'coredns_dual']
- name: add global searchdomains
- name: Add global searchdomains
set_fact:
docker_dns_search_domains: "{{ docker_dns_search_domains + searchdomains | default([]) }}"
- name: check system nameservers
- name: Check system nameservers
shell: set -o pipefail && grep "^nameserver" /etc/resolv.conf | sed -r 's/^nameserver\s*([^#\s]+)\s*(#.*)?/\1/'
args:
executable: /bin/bash
@@ -25,7 +25,7 @@
register: system_nameservers
check_mode: no
- name: check system search domains
- name: Check system search domains
# noqa risky-shell-pipe - if resolf.conf has no search domain, grep will exit 1 which would force us to add failed_when: false
# Therefore -o pipefail is not applicable in this specific instance
shell: grep "^search" /etc/resolv.conf | sed -r 's/^search\s*([^#]+)\s*(#.*)?/\1/'
@@ -35,32 +35,32 @@
register: system_search_domains
check_mode: no
- name: add system nameservers to docker options
- name: Add system nameservers to docker options
set_fact:
docker_dns_servers: "{{ docker_dns_servers | union(system_nameservers.stdout_lines) | unique }}"
when: system_nameservers.stdout
- name: add system search domains to docker options
- name: Add system search domains to docker options
set_fact:
docker_dns_search_domains: "{{ docker_dns_search_domains | union(system_search_domains.stdout.split() | default([])) | unique }}"
when: system_search_domains.stdout
- name: check number of nameservers
- name: Check number of nameservers
fail:
msg: "Too many nameservers. You can relax this check by set docker_dns_servers_strict=false in docker.yml and we will only use the first 3."
when: docker_dns_servers | length > 3 and docker_dns_servers_strict | bool
- name: rtrim number of nameservers to 3
- name: Rtrim number of nameservers to 3
set_fact:
docker_dns_servers: "{{ docker_dns_servers[0:3] }}"
when: docker_dns_servers | length > 3 and not docker_dns_servers_strict | bool
- name: check number of search domains
- name: Check number of search domains
fail:
msg: "Too many search domains"
when: docker_dns_search_domains | length > 6
- name: check length of search domains
- name: Check length of search domains
fail:
msg: "Search domains exceeded limit of 256 characters"
when: docker_dns_search_domains | join(' ') | length > 256

View File

@@ -10,10 +10,10 @@
src: http-proxy.conf.j2
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
mode: 0644
notify: restart docker
notify: Restart docker
when: http_proxy is defined or https_proxy is defined
- name: get systemd version
- name: Get systemd version
# noqa command-instead-of-module - systemctl is called intentionally here
shell: set -o pipefail && systemctl --version | head -n 1 | cut -d " " -f 2
args:
@@ -29,7 +29,7 @@
dest: /etc/systemd/system/docker.service
mode: 0644
register: docker_service_file
notify: restart docker
notify: Restart docker
when:
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
- not is_fedora_coreos
@@ -39,14 +39,14 @@
src: docker-options.conf.j2
dest: "/etc/systemd/system/docker.service.d/docker-options.conf"
mode: 0644
notify: restart docker
notify: Restart docker
- name: Write docker dns systemd drop-in
template:
src: docker-dns.conf.j2
dest: "/etc/systemd/system/docker.service.d/docker-dns.conf"
mode: 0644
notify: restart docker
notify: Restart docker
when: dns_mode != 'none' and resolvconf_mode == 'docker_dns'
- name: Copy docker orphan clean up script to the node
@@ -61,7 +61,7 @@
src: docker-orphan-cleanup.conf.j2
dest: "/etc/systemd/system/docker.service.d/docker-orphan-cleanup.conf"
mode: 0644
notify: restart docker
notify: Restart docker
when: docker_orphan_clean_up | bool
- name: Flush handlers

View File

@@ -8,7 +8,8 @@
- role: adduser
user: "{{ addusers.kube }}"
tasks:
- include_tasks: "../../../../download/tasks/download_file.yml"
- name: Download CNI
include_tasks: "../../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cni) }}"

View File

@@ -1,15 +1,15 @@
---
- name: gVisor | Download runsc binary
- name: GVisor | Download runsc binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.gvisor_runsc) }}"
- name: gVisor | Download containerd-shim-runsc-v1 binary
- name: GVisor | Download containerd-shim-runsc-v1 binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.gvisor_containerd_shim) }}"
- name: gVisor | Copy binaries
- name: GVisor | Copy binaries
copy:
src: "{{ item.src }}"
dest: "{{ bin_dir }}/{{ item.dest }}"

View File

@@ -8,7 +8,8 @@
- role: adduser
user: "{{ addusers.kube }}"
tasks:
- include_tasks: "../../../../download/tasks/download_file.yml"
- name: Download CNI
include_tasks: "../../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cni) }}"

View File

@@ -1,23 +1,23 @@
---
- name: kata-containers | Download kata binary
- name: Kata-containers | Download kata binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.kata_containers) }}"
- name: kata-containers | Copy kata-containers binary
- name: Kata-containers | Copy kata-containers binary
unarchive:
src: "{{ downloads.kata_containers.dest }}"
dest: "/"
mode: 0755
remote_src: yes
- name: kata-containers | Create config directory
- name: Kata-containers | Create config directory
file:
path: "{{ kata_containers_config_dir }}"
state: directory
mode: 0755
- name: kata-containers | Set configuration
- name: Kata-containers | Set configuration
template:
src: "{{ item }}.j2"
dest: "{{ kata_containers_config_dir }}/{{ item }}"
@@ -25,7 +25,7 @@
with_items:
- configuration-qemu.toml
- name: kata-containers | Set containerd bin
- name: Kata-containers | Set containerd bin
vars:
shim: "{{ item }}"
template:
@@ -35,7 +35,7 @@
with_items:
- qemu
- name: kata-containers | Load vhost kernel modules
- name: Kata-containers | Load vhost kernel modules
community.general.modprobe:
state: present
name: "{{ item }}"
@@ -43,7 +43,7 @@
- vhost_vsock
- vhost_net
- name: kata-containers | Persist vhost kernel modules
- name: Kata-containers | Persist vhost kernel modules
copy:
dest: /etc/modules-load.d/kubespray-kata-containers.conf
mode: 0644

View File

@@ -1,10 +1,10 @@
---
- name: nerdctl | Download nerdctl
- name: Nerdctl | Download nerdctl
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.nerdctl) }}"
- name: nerdctl | Copy nerdctl binary from download dir
- name: Nerdctl | Copy nerdctl binary from download dir
copy:
src: "{{ local_release_dir }}/nerdctl"
dest: "{{ bin_dir }}/nerdctl"
@@ -17,7 +17,7 @@
- Get nerdctl completion
- Install nerdctl completion
- name: nerdctl | Create configuration dir
- name: Nerdctl | Create configuration dir
file:
path: /etc/nerdctl
state: directory
@@ -26,7 +26,7 @@
group: root
become: true
- name: nerdctl | Install nerdctl configuration
- name: Nerdctl | Install nerdctl configuration
template:
src: nerdctl.toml.j2
dest: /etc/nerdctl/nerdctl.toml

View File

@@ -1,5 +1,5 @@
---
- name: runc | check if fedora coreos
- name: Runc | check if fedora coreos
stat:
path: /run/ostree-booted
get_attributes: no
@@ -7,18 +7,18 @@
get_mime: no
register: ostree
- name: runc | set is_ostree
- name: Runc | set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"
- name: runc | Uninstall runc package managed by package manager
- name: Runc | Uninstall runc package managed by package manager
package:
name: "{{ runc_package_name }}"
state: absent
when:
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))
- name: runc | Download runc binary
- name: Runc | Download runc binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.runc) }}"
@@ -30,7 +30,7 @@
mode: 0755
remote_src: true
- name: runc | Remove orphaned binary
- name: Runc | Remove orphaned binary
file:
path: /usr/bin/runc
state: absent

View File

@@ -1,5 +1,5 @@
---
- name: skopeo | check if fedora coreos
- name: Skopeo | check if fedora coreos
stat:
path: /run/ostree-booted
get_attributes: no
@@ -7,11 +7,11 @@
get_mime: no
register: ostree
- name: skopeo | set is_ostree
- name: Skopeo | set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"
- name: skopeo | Uninstall skopeo package managed by package manager
- name: Skopeo | Uninstall skopeo package managed by package manager
package:
name: skopeo
state: absent
@@ -19,7 +19,7 @@
- not (is_ostree or (ansible_distribution == "Flatcar Container Linux by Kinvolk") or (ansible_distribution == "Flatcar"))
ignore_errors: true # noqa ignore-errors
- name: skopeo | Download skopeo binary
- name: Skopeo | Download skopeo binary
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.skopeo) }}"

View File

@@ -1,5 +1,5 @@
---
- name: validate-container-engine | check if fedora coreos
- name: Validate-container-engine | check if fedora coreos
stat:
path: /run/ostree-booted
get_attributes: no
@@ -9,7 +9,7 @@
tags:
- facts
- name: validate-container-engine | set is_ostree
- name: Validate-container-engine | set is_ostree
set_fact:
is_ostree: "{{ ostree.stat.exists }}"
tags:

View File

@@ -8,7 +8,8 @@
- role: adduser
user: "{{ addusers.kube }}"
tasks:
- include_tasks: "../../../../download/tasks/download_file.yml"
- name: Download CNI
include_tasks: "../../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.cni) }}"

View File

@@ -1,10 +1,10 @@
---
- name: youki | Download youki
- name: Youki | Download youki
include_tasks: "../../../download/tasks/download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.youki) }}"
- name: youki | Copy youki binary from download dir
- name: Youki | Copy youki binary from download dir
copy:
src: "{{ local_release_dir }}/youki_v{{ youki_version | regex_replace('\\.', '_') }}_linux/youki-v{{ youki_version }}/youki"
dest: "{{ youki_bin_dir }}/youki"