From 976cb8a0ee9fca046aa04ec9b1ece1a2d2c388ef Mon Sep 17 00:00:00 2001 From: Roman Safronov Date: Thu, 30 Jan 2025 15:04:31 +0200 Subject: [PATCH] Add hook for upgrading crun on compute nodes An attempt to workaround https://issues.redhat.com/browse/RHEL-70694 for affected d/s ci jobs. --- hooks/playbooks/update_crun.yml | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 hooks/playbooks/update_crun.yml diff --git a/hooks/playbooks/update_crun.yml b/hooks/playbooks/update_crun.yml new file mode 100644 index 0000000000..3d046073ac --- /dev/null +++ b/hooks/playbooks/update_crun.yml @@ -0,0 +1,60 @@ +--- +- name: Add compute nodes to inventory + hosts: "{{ cifmw_target_host | default('localhost') }}" + vars: + ssh_key_file: "/tmp/key_rsa" + secret_name: dataplane-ansible-ssh-private-key-secret + namespace: openstack + tasks: + - name: Extract key to a local file + ansible.builtin.shell: | + oc get secret {{ secret_name }} -o json | jq -r '.data["ssh-privatekey"]' | base64 -d > {{ ssh_key_file }} + chmod 600 {{ ssh_key_file }} + + - name: Fetch OSP BMO nodesets + environment: + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" + PATH: "{{ cifmw_path }}" + ansible.builtin.command: + cmd: >- + oc get OpenStackBaremetalSet -n "{{ namespace|default('openstack') }}" -o yaml + register: _osp_bmo_nodsets_oc_out + + - name: Add OSP BMO nodesets to Ansible + ansible.builtin.add_host: + name: "{{ item.name }}" + groups: "{{ item.group }}" + ansible_ssh_user: "{{ item.user }}" + ansible_host: "{{ item.ip }}" + ansible_ssh_private_key_file: "{{ ssh_key_file }}" + ansible_ssh_extra_args: '-o StrictHostKeyChecking=no' + loop: >- + {% set hosts = [] -%} + {% set nodesets = (_osp_bmo_nodsets_oc_out.stdout | from_yaml)['items'] | default([]) -%} + {% for spec in nodesets | map(attribute='spec') -%} + {% for host_key, host_val in spec.baremetalHosts.items() -%} + {% set _ = hosts.append( + { + 'name': host_key, + 'ip': host_val['ctlPlaneIP'] | ansible.utils.ipaddr('address'), + 'user': spec.cloudUserName, + 'group': host_key | split('-') | first + 's' + }) -%} + {% endfor -%} + {% endfor -%} + {{ hosts }} + + +- name: Update crun on compute nodes + hosts: computes + become: yes + tasks: + - name: Update crun RPM + dnf: + name: http://file.tlv.redhat.com/~rsafrono/files/crun-1.16.1-1.el9.x86_64.rpm + disable_gpg_check: yes + + - name: Get crun version + ansible.builtin.shell: | + hostname + crun --version