Skip to content

Commit

Permalink
feat(crio): linted ansible files
Browse files Browse the repository at this point in the history
  • Loading branch information
CiraciNicolo committed Mar 29, 2024
1 parent fe57a7b commit c85fdd7
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 30 deletions.
3 changes: 3 additions & 0 deletions images/capi/.ansible-lint-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ ansible/windows/roles/systemprep/defaults/main.yml var-naming[no-role-prefix]
ansible/windows/roles/systemprep/tasks/main.yml ignore-errors
ansible/windows/roles/systemprep/tasks/main.yml name[missing]
ansible/windows/roles/systemprep/tasks/ssh-feature.yml schema[tasks]
ansible/roles/crio/defaults/main.yml yaml[line-length]
ansible/roles/crio/tasks/debian.yml yaml[line-length]
ansible/roles/crio/tasks/redhat.yml yaml[line-length]
4 changes: 2 additions & 2 deletions images/capi/ansible/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
name: node
- ansible.builtin.include_role:
name: providers
- name: "configuring {{ cri_flavour }}"
- name: "Configuring {{ cri_flavour }}"
ansible.builtin.include_role:
name: "{{ cri_flavour }}"
name: "{{ cri_flavour }}"
- ansible.builtin.include_role:
name: kubernetes
- ansible.builtin.include_role:
Expand Down
2 changes: 1 addition & 1 deletion images/capi/ansible/roles/containerd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
when: ansible_os_family == "VMware Photon OS"

- name: Export crisocket
set_fact:
ansible.builtin.set_fact:
cri_socket: "{{ containerd_cri_socket }}"

# TODO(vincepri): Use deb/rpm packages once available.
Expand Down
2 changes: 1 addition & 1 deletion images/capi/ansible/roles/crio/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
---
crio_config_file: etc/crio/crio.conf
crio_gvisor_runtime: false
crio_gvisor_version: latest
crio_gvisor_version: latest
20 changes: 12 additions & 8 deletions images/capi/ansible/roles/crio/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,35 @@

- name: Determine Version
block:
- set_fact:
- name: Set CRI-O facts
ansible.builtin.set_fact:
crio_repo_os: "x{{ ansible_distribution }}_{{ ansible_distribution_version }}"
crio_repo_version: "{{ crio_version.split('.')[:2] | join('.') }}"
when: ansible_distribution == "Ubuntu"
- set_fact:
- name: Set CRI-O facts
ansible.builtin.set_fact:
crio_repo_os: "{{ ansible_distribution }}_{{ ansible_distribution_version }}"
crio_repo_version: "{{ crio_version.split('.')[:2] | join('.') }}"
when: ansible_distribution == "Debian"

- name: Configure repo and import certificate
block:
- name: get gpg sign key
- name: Get gpg sign key
ansible.builtin.get_url:
url: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ crio_repo_os }}/Release.key"
dest: /usr/share/keyrings/libcontainers-archive-keyring.asc
- name: get gpg sign key
mode: "0644"
- name: Get gpg sign key
ansible.builtin.get_url:
url: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_repo_version }}/{{ crio_repo_os }}/Release.key"
dest: /usr/share/keyrings/libcontainers-crio-archive-keyring.asc
- name: add repository
mode: "0644"
- name: Add repository
ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/libcontainers-archive-keyring.asc] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ crio_repo_os }}/ /"
state: present
filename: devel:kubic:libcontainers:stable
- name: add repository
filename: devel:kubic:libcontainers:stable
- name: Add repository
ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/libcontainers-crio-archive-keyring.asc] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_repo_version }}/{{ crio_repo_os }}/ /"
state: present
Expand All @@ -62,4 +66,4 @@
name: "{{ item }}"
with_items:
- cri-o
- cri-o-runc
- cri-o-runc
17 changes: 11 additions & 6 deletions images/capi/ansible/roles/crio/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
- ansible.builtin.import_tasks: debian.yml
- name: Debian based
ansible.builtin.import_tasks: debian.yml
when: ansible_os_family == "Debian"

- ansible.builtin.import_tasks: redhat.yml
- name: RedHat based
ansible.builtin.import_tasks: redhat.yml
when: ansible_os_family == "RedHat"

- name: Export crisocket
set_fact:
ansible.builtin.set_fact:
cri_socket: "{{ crio_cri_socket }}"

- name: Create unit file directory
ansible.builtin.file:
path: /etc/systemd/system/crio.service.d
state: directory
mode: "0755"

- name: Create crio memory pressure drop-in file
ansible.builtin.template:
Expand All @@ -50,6 +53,7 @@
ansible.builtin.file:
path: /etc/crio
state: directory
mode: "0755"

- name: Copy in crio config file {{ crio_config_file }}
ansible.builtin.template:
Expand All @@ -61,14 +65,15 @@
ansible.builtin.template:
dest: /etc/crictl.yaml
src: etc/crictl.yaml
mode: "0644"

- name: Remove CRIO default CNI config file
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /etc/cni/net.d/100-crio-bridge.conflist
- /etc/cni/net.d/200-loopback.conflist
- /etc/cni/net.d/100-crio-bridge.conflist
- /etc/cni/net.d/200-loopback.conflist
when: crio_disable_builtin_cni | bool

- name: Start crio service
Expand Down Expand Up @@ -99,4 +104,4 @@
when: crio_gvisor_runtime | bool
changed_when:
- runsc_install_output.rc == 0
- runsc_install_output.stderr is search('Successfully added')
- runsc_install_output.stderr is search('Successfully added')
23 changes: 13 additions & 10 deletions images/capi/ansible/roles/crio/tasks/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,36 @@
---
- name: Determine Version
block:
- set_fact:
crio_repo_os: "CentOS_{{ ansible_distribution_major_version }}"
- name: Set host OS
ansible.builtin.set_fact:
crio_repo_os: "CentOS_{{ ansible_distribution_major_version }}"
when: ansible_distribution_release == "Core"
- set_fact:
crio_repo_os: "CentOS_{{ ansible_distribution_major_version }}_Stream"
- name: Set host OS
ansible.builtin.set_fact:
crio_repo_os: "CentOS_{{ ansible_distribution_major_version }}_Stream"
when: ansible_distribution_release != "Core"
- set_fact:
- name: Set CRIO version
ansible.builtin.set_fact:
crio_repo_version: "{{ crio_version.split('.')[:2] | join('.') }}"

- name: Configure repos
block:
- name: add repository
- name: Add repository
ansible.builtin.yum_repository:
name: devel_kubic_libcontainers_stable
baseurl: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ crio_repo_os }}/"
gpgkey: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ crio_repo_os }}/repodata/repomd.xml.key"
description: Stable Releases of Upstream github.com/containers packages ({{ crio_repo_os }})
- name: add repository
- name: Add repository
ansible.builtin.yum_repository:
name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_repo_version }}"
baseurl: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_repo_version }}/{{ crio_repo_os }}/"
baseurl: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_repo_version }}/{{ crio_repo_os }}/"
gpgkey: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_repo_version }}/{{ crio_repo_os }}/repodata/repomd.xml.key"
description: "devel:kubic:libcontainers:stable:cri-o:{{ crio_repo_version }} ({{ crio_repo_os }})"
description: "devel:kubic:libcontainers:stable:cri-o:{{ crio_repo_version }} ({{ crio_repo_os }})"

- name: Install crio
ansible.builtin.yum:
update_cache: true
name: "{{ item }}"
with_items:
- cri-o
- cri-o
2 changes: 1 addition & 1 deletion images/capi/ansible/roles/gpu/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
community.general.modprobe:
name: nouveau
state: absent
failed_when: false
failed_when: false

- name: Include AMD
ansible.builtin.include_tasks: amd.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
$service = Get-Service "Windefend"
$service.WaitForStatus("Running","00:5:00")
Update-MpSignature
failed_when: false
ignore_errors: true

# Find KB Article numbers:
# - WS 2019 https://support.microsoft.com/en-us/help/4464619
Expand Down

0 comments on commit c85fdd7

Please sign in to comment.