Skip to content

Commit

Permalink
install cri-o with rpm-ostree if ostree filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
spaced committed Nov 16, 2024
1 parent c4b53ff commit b790775
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions roles/container-engine/cri-o/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,40 @@
set_fact:
is_ostree: "{{ ostree.stat.exists }}"

- 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
- name: Cri-o | ostree | add yum repo
copy:
content: |
[cri-o]
name=CRI-O
baseurl=https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ kube_major_version }}/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ kube_major_version }}/rpm/repodata/repomd.xml.key
dest: /etc/yum.repos.d/cri-o.repo
when: is_ostree

- name: Cri-o | ostree | install via rpm-ostree
community.general.rpm_ostree_pkg:
name: cri-o
state: present
when: is_ostree
register: rpm_ostree_pkg

- name: Cri-o | ostree | install via rpm-ostree
reboot:
reboot_timeout: 240
when:
- is_ostree
- rpm_ostree_pkg.changed

- name: Cri-o | ostree | add link to installed crio binary
file:
src: '/usr/bin/crio'
dest: '{{ bin_dir }}/crio'
state: link
when:
- is_ostree

- name: Cri-o | Download cri-o
include_tasks: "../../../download/tasks/download_file.yml"
vars:
Expand Down Expand Up @@ -88,13 +115,15 @@
with_items:
- "{{ crio_bin_files }}"
notify: Restart crio
when: not is_ostree

- name: Cri-o | create directory for libexec
file:
path: "{{ crio_libexec_dir }}"
state: directory
owner: root
mode: "0755"
when: not is_ostree

- name: Cri-o | copy libexec
copy:
Expand All @@ -105,6 +134,7 @@
with_items:
- "{{ crio_libexec_files }}"
notify: Restart crio
when: not is_ostree

- name: Cri-o | copy service file
copy:
Expand All @@ -113,6 +143,7 @@
mode: "0755"
remote_src: true
notify: Restart crio
when: not is_ostree

- name: Cri-o | configure crio to use kube reserved cgroups
ansible.builtin.copy:
Expand All @@ -134,6 +165,7 @@
regexp: "/usr/local/bin/crio"
replace: "{{ bin_dir }}/crio"
notify: Restart crio
when: not is_ostree

- name: Cri-o | copy default policy
copy:
Expand Down

0 comments on commit b790775

Please sign in to comment.