handlers
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 1m21s Details

This commit is contained in:
Gleb Koval 2023-09-10 23:33:43 +01:00
parent fce7d91115
commit ab54c18b1b
Signed by: cyclane
GPG Key ID: 15E168A8B332382C
1 changed files with 22 additions and 11 deletions

View File

@ -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