Update ansible code
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
a1adffbf4c
commit
1e20bf368e
3 changed files with 132 additions and 131 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Restart cri-o
|
- name: Restart cri-o
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: crio
|
name: crio
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
242
tasks/main.yml
242
tasks/main.yml
|
|
@ -1,141 +1,141 @@
|
||||||
---
|
---
|
||||||
- name: CRI-O setup
|
- name: CRI-O setup
|
||||||
block:
|
block:
|
||||||
- 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: Create thin volumes for containers
|
- name: Create thin volumes for containers
|
||||||
lvol:
|
community.general.lvol:
|
||||||
vg: "{{ item.vg }}"
|
vg: "{{ item.vg }}"
|
||||||
lv: "{{ item.name }}"
|
lv: "{{ item.name }}"
|
||||||
thinpool: kubernetes
|
thinpool: kubernetes
|
||||||
size: "{{ item.size }}"
|
size: "{{ item.size }}"
|
||||||
with_items:
|
with_items:
|
||||||
- { name: var_lib_containers, vg: vg_sys, size: "{{ lv_containers_size | default('10g') }}", mount_point: /var/lib/containers, mount_opts: "discard"}
|
- { name: var_lib_containers, vg: vg_sys, size: "{{ lv_containers_size | default('10g') }}", mount_point: /var/lib/containers, mount_opts: "discard"}
|
||||||
|
|
||||||
- name: create file system on containers lv
|
- name: create file system on containers 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_containers, vg: vg_sys, size: "{{ lv_containers_size | default('10g') }}", mount_point: /var/lib/containers, mount_opts: "discard"}
|
- { name: var_lib_containers, vg: vg_sys, size: "{{ lv_containers_size | default('10g') }}", mount_point: /var/lib/containers, 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
|
||||||
opts: "{{ item.mount_opts }}"
|
opts: "{{ item.mount_opts }}"
|
||||||
state: mounted
|
state: mounted
|
||||||
with_items:
|
with_items:
|
||||||
- { name: var_lib_containers, vg: vg_sys, size: "{{ lv_containers_size | default('10g') }}", mount_point: /var/lib/containers, mount_opts: "discard"}
|
- { name: var_lib_containers, vg: vg_sys, size: "{{ lv_containers_size | default('10g') }}", mount_point: /var/lib/containers, mount_opts: "discard"}
|
||||||
|
|
||||||
- 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
|
||||||
owner: root
|
owner: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_items:
|
with_items:
|
||||||
- "br_netfilter"
|
- "br_netfilter"
|
||||||
- "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:
|
||||||
- br_netfilter
|
- br_netfilter
|
||||||
- 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
|
||||||
reload: yes
|
reload: true
|
||||||
with_items:
|
with_items:
|
||||||
- "net.bridge.bridge-nf-call-iptables"
|
- "net.bridge.bridge-nf-call-iptables"
|
||||||
- "net.ipv4.ip_forward"
|
- "net.ipv4.ip_forward"
|
||||||
- "net.bridge.bridge-nf-call-ip6tables"
|
- "net.bridge.bridge-nf-call-ip6tables"
|
||||||
|
|
||||||
- name: Install dnf-plugins-core package
|
- name: Install dnf-plugins-core package
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: dnf-plugins-core
|
name: dnf-plugins-core
|
||||||
state: present
|
state: present
|
||||||
- name: Add container-selinux repository
|
- name: Add container-selinux repository
|
||||||
command:
|
ansible.builtin.command:
|
||||||
cmd: dnf -y copr enable rhcontainerbot/container-selinux
|
cmd: dnf -y copr enable rhcontainerbot/container-selinux
|
||||||
creates: /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:rhcontainerbot:container-selinux.repo
|
creates: /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:rhcontainerbot:container-selinux.repo
|
||||||
warn: no
|
warn: no
|
||||||
- name: Install container-selinux GPG key
|
- name: Install container-selinux GPG key
|
||||||
rpm_key:
|
ansible.builtin.rpm_key:
|
||||||
key: "https://download.copr.fedorainfracloud.org/results/rhcontainerbot/container-selinux/pubkey.gpg"
|
key: "https://download.copr.fedorainfracloud.org/results/rhcontainerbot/container-selinux/pubkey.gpg"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Registering libcontainers repository
|
- name: Registering libcontainers repository
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_{{ ansible_distribution_major_version }}/devel:kubic:libcontainers:stable.repo
|
url: https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_{{ ansible_distribution_major_version }}/devel:kubic:libcontainers:stable.repo
|
||||||
dest: /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo
|
dest: /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
- name: Install libcontainers GPG key
|
- name: Install libcontainers GPG key
|
||||||
rpm_key:
|
ansible.builtin.rpm_key:
|
||||||
key: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
|
key: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Registering CRI-O {{ crio_version }} repository
|
- name: Registering CRI-O {{ crio_version }} repository
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/devel:kubic:libcontainers:stable:cri-o:{{ crio_version }}.repo"
|
url: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/devel:kubic:libcontainers:stable:cri-o:{{ crio_version }}.repo"
|
||||||
dest: "/etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:{{ crio_version }}.repo"
|
dest: "/etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:{{ crio_version }}.repo"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
- name: Install CRI-O GPG key
|
- name: Install CRI-O GPG key
|
||||||
rpm_key:
|
ansible.builtin.rpm_key:
|
||||||
key: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
|
key: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Update package manager list
|
- name: Update package manager list
|
||||||
package:
|
ansible.builtin.package:
|
||||||
update_cache: yes
|
update_cache: true
|
||||||
|
|
||||||
- name: Install cri-o package
|
- name: Install cri-o package
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ crio_package_name }}"
|
name: "{{ crio_package_name }}"
|
||||||
state: present
|
state: present
|
||||||
notify: Restart cri-o
|
notify: Restart cri-o
|
||||||
|
|
||||||
- name: Ensuring /etc/crio/crio.conf.d folder exists
|
- name: Ensuring /etc/crio/crio.conf.d folder exists
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/crio/crio.conf.d"
|
path: "/etc/crio/crio.conf.d"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
group: root
|
group: root
|
||||||
owner: root
|
owner: root
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Configuring cri-o
|
- name: Configuring cri-o
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "etc/crio/crio.conf.d/{{ item }}.j2"
|
src: "etc/crio/crio.conf.d/{{ item }}.j2"
|
||||||
dest: "/etc/crio/crio.conf.d/{{ item }}"
|
dest: "/etc/crio/crio.conf.d/{{ item }}"
|
||||||
group: root
|
group: root
|
||||||
owner: root
|
owner: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_items:
|
with_items:
|
||||||
# - "01-crio-runtime.conf"
|
# - "01-crio-runtime.conf"
|
||||||
# - "01-cgroup-manager.conf"
|
# - "01-cgroup-manager.conf"
|
||||||
- "01-log-level.conf"
|
- "01-log-level.conf"
|
||||||
- "01-metrics.conf"
|
- "01-metrics.conf"
|
||||||
# - "01-crio-network.conf"
|
# - "01-crio-network.conf"
|
||||||
notify: Restart cri-o
|
notify: Restart cri-o
|
||||||
|
|
||||||
- name: Enable cri-o on boot
|
- name: Enable cri-o on boot
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: crio
|
name: crio
|
||||||
state: restarted
|
state: restarted
|
||||||
enabled: yes
|
enabled: true
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- crio
|
- crio
|
||||||
Loading…
Add table
Add a link
Reference in a new issue