WIP: Initial VM provisioning #4
|
@ -36,16 +36,11 @@
|
||||||
clone: "{{ node }}-debian-12"
|
clone: "{{ node }}-debian-12"
|
||||||
storage: nvme
|
storage: nvme
|
||||||
register: create
|
register: create
|
||||||
|
notify:
|
||||||
|
- Initial boot
|
||||||
- name: Debug
|
- name: Debug
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
var: create
|
var: create
|
||||||
- name: Wait for VM to exist
|
|
||||||
community.general.proxmox_kvm:
|
|
||||||
state: current
|
|
||||||
register: vm
|
|
||||||
retries: 30
|
|
||||||
delay: 10
|
|
||||||
until: vm.status is defined
|
|
||||||
- name: Add HOME NIC
|
- name: Add HOME NIC
|
||||||
community.general.proxmox_nic:
|
community.general.proxmox_nic:
|
||||||
interface: net0
|
interface: net0
|
||||||
|
@ -78,14 +73,30 @@
|
||||||
memory: 2048
|
memory: 2048
|
||||||
- name: Retart VM # doesn't start if stopped
|
- name: Retart VM # doesn't start if stopped
|
||||||
when:
|
when:
|
||||||
- vm.status is defined
|
- create.status is defined
|
||||||
- vm.status == "running"
|
- create.status == "running"
|
||||||
community.general.proxmox_kvm:
|
community.general.proxmox_kvm:
|
||||||
state: restarted
|
state: restarted
|
||||||
timeout: 60
|
timeout: 60
|
||||||
- name: Start VM # start if stopped
|
- name: Start VM # start if stopped
|
||||||
when:
|
when:
|
||||||
- vm.status is defined
|
- create.status is defined
|
||||||
- vm.status != "running"
|
- create.status != "running"
|
||||||
community.general.proxmox_kvm:
|
community.general.proxmox_kvm:
|
||||||
state: started
|
state: started
|
||||||
|
handlers:
|
||||||
|
- name: Initial boot
|
||||||
|
block:
|
||||||
|
- name: Start
|
||||||
|
community.general.proxmox_kvm:
|
||||||
|
state: started
|
||||||
|
register: start
|
||||||
|
retries: 30
|
||||||
|
delay: 10
|
||||||
|
until: start.status is defined
|
||||||
|
- name: Wait
|
||||||
|
ansible.builtin.wait_for:
|
||||||
|
timeout: 180
|
||||||
|
- name: Poweroff
|
||||||
|
community.general.proxmox_kvm:
|
||||||
|
state: stopped
|
||||||
|
|
Loading…
Reference in New Issue