Skip to content

Commit d450861

Browse files
claudia-lolarocky Cloud User
authored andcommitted
edits to create-virtual-baremetal playbook
1 parent 200d6f6 commit d450861

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

etc/kayobe/environments/stackhpc-sushy-baremetal/ansible/create-virtual-baremetal.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
libvirt_vms:
3838
- state: present
3939
name: "{{ inventory_hostname }}"
40-
xml_file: "{{ sushy_directory }}/vbmc-node.xml.j2"
40+
memory_mb: '4657'
41+
vcpus: '2'
42+
# xml_file: "{{ sushy_directory }}/vbmc-node.xml.j2"
4143
volumes:
4244
- name: '{{ inventory_hostname }}.qcow2'
4345
device: 'disk'
@@ -52,13 +54,24 @@
5254
delegate_to: localhost
5355

5456
- name: Discover Virtual Baremetal UUID
55-
ansible.builtin.command:
56-
cmd: "sudo virsh domuuid {{ inventory_hostname }}"
57-
register: sushy_uuid
58-
failed_when:
59-
- sushy_uuid.rc != 0
60-
changed_when: false
57+
ansible.builtin.command: "virsh domuuid {{ inventory_hostname }}"
58+
register: vm_uuid_result
59+
delegate_to: localhost
6160

62-
- name: Set uuid fact
61+
- name: Persist UUID fact
6362
ansible.builtin.set_fact:
64-
uuid: "{{ sushy_uuid.stdout }}"
63+
uuid: "{{ vm_uuid_result.stdout }}"
64+
delegate_to: "{{ inventory_hostname }}"
65+
delegate_facts: true
66+
67+
- name: Ensure host_vars directory exists
68+
ansible.builtin.file:
69+
path: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}"
70+
state: directory
71+
delegate_to: localhost
72+
73+
- name: Write UUID to host_vars
74+
ansible.builtin.copy:
75+
dest: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}/uuid.yml"
76+
content: "uuid: {{ vm_uuid_result.stdout }}\n"
77+
delegate_to: localhost

etc/kayobe/environments/stackhpc-sushy-baremetal/ansible/sushy-1.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
gather_facts: false
66
tasks:
77
- name: Install package dependencies
8-
ansible.builtin.dnf:
9-
name:
10-
- qemu-kvm
11-
- libvirt
12-
- libvirt-devel
13-
- python3-devel
14-
state: present
8+
ansible.builtin.dnf:
9+
name:
10+
- qemu-kvm
11+
- libvirt
12+
- libvirt-devel
13+
- python3-devel
14+
state: present
1515

1616
- name: Start and enable the QEMU service
1717
ansible.builtin.systemd_service:

etc/kayobe/environments/stackhpc-sushy-baremetal/inventory/group_vars/sushy-libvirt/ironic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
ironic_redfish_system_id: "{{ '/redfish/v1/Systems/' + inventory_hostname | to_uuid }}"
3+
ironic_redfish_system_id: "{{ '/redfish/v1/Systems/' + hostvars[inventory_hostname]['uuid'] }}"
44

55
redifsh_address: "http://192.168.33.3:34343"
66
ironic_redfish_address: "192.168.33.3:34343"

0 commit comments

Comments
 (0)