Update ansible code
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Adrien Reslinger 2022-08-16 16:52:29 +02:00
parent 505701376c
commit da38873dd7
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
4 changed files with 34 additions and 31 deletions

View file

@ -1,2 +1,2 @@
--- ---
containerd_debug: false containerd_debug: false

View file

@ -1,4 +1,5 @@
--- ---
- name: Restart containerd - name: Restart containerd
service: name=containerd state=restarted ansible.builtin.service:
name: containerd
state: restarted

View file

@ -6,11 +6,13 @@ galaxy_info:
galaxy_tags: [] galaxy_tags: []
license: GPL2 license: GPL2
platforms: platforms:
- name: CentOS - name: CentOS
version: version:
- 7 - 7
- 8 - 8
- name: RedHat - 9
version: - name: RedHat
- 7 version:
- 8 - 7
- 8
- 9

View file

@ -1,23 +1,23 @@
--- ---
- name: Include vars for {{ ansible_os_family }} - name: Include vars for {{ ansible_os_family }}
include_vars: "{{ ansible_os_family }}.yml" ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
- name: Add Official docker's repo - name: Add Official docker's repo
get_url: ansible.builtin.get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo dest: /etc/yum.repos.d/docker-ce.repo
mode: 0644 mode: 0644
when: when:
- ansible_os_family == "RedHat" - ansible_os_family == "RedHat"
#- name: Remove all other's containerd version packages # - name: Remove all other's containerd version packages
# package: # ansible.builtin.package:
# name: "{{ containerd_remove_packages_name }}" # name: "{{ containerd_remove_packages_name }}"
# state: absent # state: absent
# update_cache: yes # update_cache: true
- name: Create thin volumes for containerd - name: Create thin volumes for containerd
lvol: community.general.lvol:
vg: "{{ item.vg }}" vg: "{{ item.vg }}"
lv: "{{ item.name }}" lv: "{{ item.name }}"
thinpool: kubernetes thinpool: kubernetes
@ -26,14 +26,14 @@
- { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"} - { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"}
- name: create file system on containerd lv - name: create file system on containerd lv
filesystem: community.general.filesystem:
fstype: ext4 fstype: ext4
dev: "/dev/{{ item.vg }}/{{ item.name }}" dev: "/dev/{{ item.vg }}/{{ item.name }}"
with_items: with_items:
- { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"} - { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"}
- name: mount logical volumes - name: mount logical volumes
mount: ansible.posix.mount:
name: "{{ item.mount_point }}" name: "{{ item.mount_point }}"
src: "/dev/{{ item.vg }}/{{ item.name }}" src: "/dev/{{ item.vg }}/{{ item.name }}"
fstype: ext4 fstype: ext4
@ -43,20 +43,20 @@
- { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"} - { name: var_lib_containerd, vg: vg_sys, size: 10g, mount_point: /var/lib/containerd, mount_opts: "discard"}
- name: Install containerd - name: Install containerd
package: ansible.builtin.package:
name: "{{ containerd_package_name }}" name: "{{ containerd_package_name }}"
state: present state: present
update_cache: yes update_cache: true
notify: Restart containerd notify: Restart containerd
- name: Enable containerd on boot - name: Enable containerd on boot
service: ansible.builtin.service:
name: containerd name: containerd
state: started state: started
enabled: yes enabled: true
- name: Configuring kernel module to be load on boot - name: Configuring kernel module to be load on boot
template: ansible.builtin.template:
src: "etc/modules-load.d/{{ item }}.conf.j2" src: "etc/modules-load.d/{{ item }}.conf.j2"
dest: "/etc/modules-load.d/{{ item }}.conf" dest: "/etc/modules-load.d/{{ item }}.conf"
group: root group: root
@ -67,7 +67,7 @@
- "overlay" - "overlay"
- name: Load kernel module - name: Load kernel module
modprobe: community.general.modprobe:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
with_items: with_items:
@ -75,7 +75,7 @@
- overlay - overlay
- name: Configure sysctl - name: Configure sysctl
sysctl: ansible.posix.sysctl:
name: "{{ item }}" name: "{{ item }}"
value: "1" value: "1"
sysctl_file: /etc/sysctl.d/99-kubernetes-cri.conf sysctl_file: /etc/sysctl.d/99-kubernetes-cri.conf
@ -86,7 +86,7 @@
- "net.bridge.bridge-nf-call-ip6tables" - "net.bridge.bridge-nf-call-ip6tables"
- name: Ensuring /etc/containerd folder exists - name: Ensuring /etc/containerd folder exists
file: ansible.builtin.file:
path: "/etc/containerd" path: "/etc/containerd"
state: "directory" state: "directory"
group: root group: root
@ -94,7 +94,7 @@
mode: 0755 mode: 0755
- name: Configuring containerd - name: Configuring containerd
template: ansible.builtin.template:
src: "etc/containerd/config.toml.j2" src: "etc/containerd/config.toml.j2"
dest: "/etc/containerd/config.toml" dest: "/etc/containerd/config.toml"
group: root group: root
@ -103,4 +103,4 @@
notify: Restart containerd notify: Restart containerd
- name: Flush handlers - name: Flush handlers
meta: flush_handlers ansible.builtin.meta: flush_handlers