Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2025-06-07 00:16:54 +02:00
parent 6ff1ccecd0
commit 02168225b1
11 changed files with 187 additions and 25 deletions

View File

@@ -32,6 +32,37 @@
vmid: "{{ vm.vmid }}"
state: started
- name: Stop VM
community.general.proxmox_kvm:
api_user: root@pam
api_password: "{{ vault.pve.aya01.root.sudo }}"
api_host: "192.168.20.12"
node: "{{ vm.node }}"
vmid: "{{ vm.vmid }}"
state: stopped
force: true
- name: Wait until VM is fully stopped
community.general.proxmox_vm_info:
api_user: "root@pam"
api_password: "{{ vault.pve.aya01.root.sudo }}"
api_host: "192.168.20.12"
node: "{{ vm.node }}"
vmid: "{{ vm.vmid }}"
register: vm_status_check
until: vm_status_check.proxmox_vms[0].status == "stopped"
retries: 24
delay: 5
- name: Start VM
community.general.proxmox_kvm:
api_user: root@pam
api_password: "{{ vault.pve.aya01.root.sudo }}"
api_host: "192.168.20.12"
node: "{{ vm.node }}"
vmid: "{{ vm.vmid }}"
state: started
- name: Wait for VM to appear on network
ansible.builtin.shell: |
nmap -sn -n -PR 192.168.20.0/24 | grep -B2 "{{ mac_address }}" | grep "Nmap scan report for"