Skip to content

Commit 7530521

Browse files
committed
added ignition script as CDROM
1 parent 8adcc98 commit 7530521

File tree

1 file changed

+77
-46
lines changed

1 file changed

+77
-46
lines changed

ocp/4.15/upi/ansible/28-proxmox-vm-start.yaml

Lines changed: 77 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,91 @@
44
gather_facts: true
55

66
tasks:
7-
- name: "Stop the bootstrap VM on it's node"
8-
ansible.builtin.shell: |
9-
qm stop {{ hostvars[item].pve.vmid }}
10-
loop: "{{ groups['ocp_bootstrap'] }}"
11-
when: groups['ocp_bootstrap'] is defined and ansible_hostname == hostvars[item].pve.owner
7+
- name: "Build VM list"
8+
ansible.builtin.set_fact:
9+
# vm_host_list: "{{ (groups['ocp_bootstrap'] | default([])) + (groups['ocp_control_plane'] | default([])) + (groups['ocp_compute_node'] | default([])) }}"
10+
vm_host_list: "{{ (groups['ocp_bootstrap'] | default([])) + (groups['ocp_control_plane'] | default([])) }}"
1211

13-
- name: "Stop the control plane VMs on it's node"
14-
ansible.builtin.shell: |
15-
qm stop {{ hostvars[item].pve.vmid }}
16-
loop: "{{ groups['ocp_control_plane'] }}"
17-
when: groups['ocp_control_plane'] is defined and ansible_hostname == hostvars[item].pve.owner
12+
- name: "Stop all VM on it's node"
13+
ansible.builtin.include_tasks:
14+
file: tasks/proxmox_vm_start.yaml
15+
vars:
16+
vm_name: "{{ item }}"
17+
state: "Stopped"
18+
loop: "{{ vm_host_list }}"
19+
when: ansible_hostname == hostvars[item].pve.owner
1820

19-
- name: "Stop the compute node VMs on it's node"
20-
ansible.builtin.shell: |
21-
qm stop {{ hostvars[item].pve.vmid }}
22-
loop: "{{ groups['ocp_compute_node'] }}"
23-
when: use_compute_nodes and groups['ocp_compute_node'] is defined and ansible_hostname == hostvars[item].pve.owner
21+
# - name: "Stop the bootstrap VM on it's node"
22+
# ansible.builtin.shell: |
23+
# qm stop {{ hostvars[item].pve.vmid }}
24+
# loop: "{{ groups['ocp_bootstrap'] }}"
25+
# when: groups['ocp_bootstrap'] is defined and ansible_hostname == hostvars[item].pve.owner
2426

25-
- name: "Set values for the Bootstrap VM"
26-
ansible.builtin.shell: |
27-
qm set {{ hostvars[item].pve.vmid }} --cdrom none
28-
qm set {{ hostvars[item].pve.vmid }} --boot 'order=scsi0;ide2;net0'
29-
loop: "{{ groups['ocp_bootstrap'] }}"
30-
when: groups['ocp_bootstrap'] is defined and ansible_hostname == hostvars[item].pve.owner
27+
# - name: "Stop the control plane VMs on it's node"
28+
# ansible.builtin.shell: |
29+
# qm stop {{ hostvars[item].pve.vmid }}
30+
# loop: "{{ groups['ocp_control_plane'] }}"
31+
# when: groups['ocp_control_plane'] is defined and ansible_hostname == hostvars[item].pve.owner
3132

32-
- name: "Set values for for the Control Plane VMs"
33-
ansible.builtin.shell: |
34-
qm set {{ hostvars[item].pve.vmid }} --cdrom none
35-
qm set {{ hostvars[item].pve.vmid }} --boot 'order=scsi0;ide2;net0'
36-
loop: "{{ groups['ocp_control_plane'] }}"
37-
when: groups['ocp_control_plane'] is defined and ansible_hostname == hostvars[item].pve.owner
33+
# - name: "Stop the compute node VMs on it's node"
34+
# ansible.builtin.shell: |
35+
# qm stop {{ hostvars[item].pve.vmid }}
36+
# loop: "{{ groups['ocp_compute_node'] }}"
37+
# when: use_compute_nodes and groups['ocp_compute_node'] is defined and ansible_hostname == hostvars[item].pve.owner
3838

39-
- name: "Set values for the Compute Node VMs"
39+
- name: "Set values for the VMs"
4040
ansible.builtin.shell: |
41-
qm set {{ hostvars[item].pve.vmid }} --cdrom none
41+
qm set {{ hostvars[item].pve.vmid }} -ide2 none,media=cdrom
42+
qm set {{ hostvars[item].pve.vmid }} -ide0 none,media=cdrom
4243
qm set {{ hostvars[item].pve.vmid }} --boot 'order=scsi0;ide2;net0'
43-
loop: "{{ groups['ocp_compute_node'] }}"
44-
when: groups['ocp_compute_node'] is defined and ansible_hostname == hostvars[item].pve.owner
44+
loop: "{{ vm_host_list }}"
45+
when: ansible_hostname == hostvars[item].pve.owner
4546

46-
- name: "Start the bootstrap VM"
47-
ansible.builtin.shell: |
48-
qm start {{ hostvars[item].pve.vmid }}
49-
loop: "{{ groups['ocp_bootstrap'] }}"
50-
when: groups['ocp_bootstrap'] is defined and ansible_hostname == hostvars[item].pve.owner
47+
# - name: "Set values for the Bootstrap VM"
48+
# ansible.builtin.shell: |
49+
# qm set {{ hostvars[item].pve.vmid }} --cdrom none
50+
# qm set {{ hostvars[item].pve.vmid }} --boot 'order=scsi0;ide2;net0'
51+
# loop: "{{ groups['ocp_bootstrap'] }}"
52+
# when: groups['ocp_bootstrap'] is defined and ansible_hostname == hostvars[item].pve.owner
5153

52-
- name: "Start the Control Plane VMs"
53-
ansible.builtin.shell: |
54-
qm start {{ hostvars[item].pve.vmid }}
55-
loop: "{{ groups['ocp_control_plane'] }}"
56-
when: groups['ocp_control_plane'] is defined and ansible_hostname == hostvars[item].pve.owner
54+
# - name: "Set values for for the Control Plane VMs"
55+
# ansible.builtin.shell: |
56+
# qm set {{ hostvars[item].pve.vmid }} --cdrom none
57+
# qm set {{ hostvars[item].pve.vmid }} --boot 'order=scsi0;ide2;net0'
58+
# loop: "{{ groups['ocp_control_plane'] }}"
59+
# when: groups['ocp_control_plane'] is defined and ansible_hostname == hostvars[item].pve.owner
5760

58-
- name: "Start the Compute Node VMs - NOT FOR NOW"
59-
ansible.builtin.shell: |
60-
qm start {{ hostvars[item].pve.vmid }} --cdrom local:iso/{{ coreos_image_filename }}
61-
loop: "{{ groups['ocp_compute_node'] }}"
62-
when: use_compute_nodes and groups['ocp_compute_node'] is defined and ansible_hostname == hostvars[item].pve.owner
61+
# - name: "Set values for the Compute Node VMs"
62+
# ansible.builtin.shell: |
63+
# qm set {{ hostvars[item].pve.vmid }} --cdrom none
64+
# qm set {{ hostvars[item].pve.vmid }} --boot 'order=scsi0;ide2;net0'
65+
# loop: "{{ groups['ocp_compute_node'] }}"
66+
# when: groups['ocp_compute_node'] is defined and ansible_hostname == hostvars[item].pve.owner
67+
68+
- name: "Start all VM on it's node"
69+
ansible.builtin.include_tasks:
70+
file: tasks/proxmox_vm_start.yaml
71+
vars:
72+
vm_name: "{{ item }}"
73+
state: "Started"
74+
loop: "{{ vm_host_list }}"
75+
when: ansible_hostname == hostvars[item].pve.owner
76+
77+
# - name: "Start the bootstrap VM"
78+
# ansible.builtin.shell: |
79+
# qm start {{ hostvars[item].pve.vmid }}
80+
# loop: "{{ groups['ocp_bootstrap'] }}"
81+
# when: groups['ocp_bootstrap'] is defined and ansible_hostname == hostvars[item].pve.owner
82+
83+
# - name: "Start the Control Plane VMs"
84+
# ansible.builtin.shell: |
85+
# qm start {{ hostvars[item].pve.vmid }}
86+
# loop: "{{ groups['ocp_control_plane'] }}"
87+
# when: groups['ocp_control_plane'] is defined and ansible_hostname == hostvars[item].pve.owner
88+
89+
# - name: "Start the Compute Node VMs - NOT FOR NOW"
90+
# ansible.builtin.shell: |
91+
# qm start {{ hostvars[item].pve.vmid }} --cdrom local:iso/{{ coreos_image_filename }}
92+
# loop: "{{ groups['ocp_compute_node'] }}"
93+
# when: use_compute_nodes and groups['ocp_compute_node'] is defined and ansible_hostname == hostvars[item].pve.owner
6394
...

0 commit comments

Comments
 (0)