-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |