Skip to content

Commit 9cd7720

Browse files
committed
Fix pci-passthrough.yml handlers
1 parent 8a06ffb commit 9cd7720

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

etc/kayobe/ansible/pci-passthrough.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
# and before overcloud host configure - we can't assume
77
# users and venvs exist.
88
ansible_user: "{{ bootstrap_user }}"
9-
ansible_python_interpreter: "/usr/bin/python3"
109
ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
10+
ansible_python_interpreter: "/usr/bin/python3"
1111
vfio_pci_ids: |-
1212
{% set output = [] %}
1313
{% for gpu_type in gpu_group_map | dict2items | map(attribute='value') | flatten | unique | default([]) %}
1414
{% set _ = output.append(stackhpc_gpu_data[gpu_type]['vendor_id'] + ':' + stackhpc_gpu_data[gpu_type]['product_id']) %}
1515
{% endfor %}
1616
{{ output | join(',') }}
17+
reboot_timeout_s: "{{ 20 * 60 }}"
1718
tasks:
1819
- name: Template dracut config
1920
blockinfile:
@@ -27,7 +28,7 @@
2728
become: true
2829
notify:
2930
- Regenerate initramfs
30-
- reboot
31+
- Reboot
3132

3233
- name: Add vfio to modules-load.d
3334
blockinfile:
@@ -56,7 +57,7 @@
5657
create: true
5758
become: true
5859
notify:
59-
- reboot
60+
- Reboot
6061
- Regenerate initramfs
6162

6263
- name: Ignore unsupported model specific registers
@@ -83,7 +84,7 @@
8384
group: root
8485
create: true
8586
become: true
86-
notify: reboot
87+
notify: Reboot
8788

8889
- name: Add vfio-pci.ids kernel args
8990
include_role:
@@ -99,10 +100,36 @@
99100
- vfio-pci.ids
100101

101102
handlers:
102-
- name: Regenerate initramfs
103-
command: /usr/sbin/update-initramfs -u
103+
- name: Regenerate initramfs (RedHat)
104+
listen: Regenerate initramfs
105+
ansible.builtin.shell: |-
106+
#!/bin/bash
107+
set -eux
108+
dracut -v -f /boot/initramfs-$(uname -r).img $(uname -r)
104109
become: true
110+
changed_when: true
111+
when: ansible_facts.os_family == 'RedHat'
105112

106-
# TODO: Check if this works
107-
- name: reboot
108-
import_playbook: reboot.yml
113+
- name: Regenerate initramfs (Debian)
114+
listen: Regenerate initramfs
115+
ansible.builtin.shell: |-
116+
#!/bin/bash
117+
set -eux
118+
update-initramfs -u -k $(uname -r)
119+
become: true
120+
changed_when: true
121+
when: ansible_facts.os_family == 'Debian'
122+
123+
- name: Reboot
124+
become: true
125+
ansible.builtin.reboot:
126+
reboot_timeout: "{{ reboot_timeout_s }}"
127+
search_paths:
128+
# Systems running molly-guard hang waiting for confirmation before rebooting without this.
129+
- /lib/molly-guard
130+
# Default list:
131+
- /sbin
132+
- /bin
133+
- /usr/sbin
134+
- /usr/bin
135+
- /usr/local/sbin

0 commit comments

Comments
 (0)