feat(proxmox): check_vm as cronjob

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2025-09-02 19:52:49 +02:00
parent 7aa16f3207
commit a1da69ac98
2 changed files with 25 additions and 18 deletions

View File

@@ -17,6 +17,7 @@
ansible.builtin.shell: |
qm set {{ vm.vmid }} --scsi0 {{ proxmox_storage }}:{{ vm.vmid }}/vm-{{ vm.vmid }}-disk-0.raw --ide2 {{ proxmox_storage }}:cloudinit --boot order=scsi0
delegate_to: "{{ vm.node }}"
changed_when: true
- name: Resize scsi0 disk if needed
ansible.builtin.shell: |
@@ -86,3 +87,17 @@
# create: true
# state: present
# delegate_to: localhost
- name: Copy VM check script to node
ansible.builtin.copy:
src: check_proxmox_vm.sh
dest: /usr/local/bin/check_proxmox_vm.sh
mode: '0755'
delegate_to: "{{ vm.node }}"
- name: Schedule VM check script
ansible.builtin.cron:
name: "Check VM {{ vm.name }}"
job: "/usr/local/bin/check_proxmox_vm.sh {{ vm.vmid }} {{ vm_found_ip }}"
minute: "*/5"
delegate_to: "{{ vm.node }}"