35 lines
1.0 KiB
YAML
35 lines
1.0 KiB
YAML
---
|
|
- name: Setup Cleanup
|
|
when: hypervisor_type == "proxmox"
|
|
delegate_to: localhost
|
|
become: false
|
|
module_defaults:
|
|
community.proxmox.proxmox_disk:
|
|
api_host: "{{ hypervisor_cfg.url }}"
|
|
api_user: "{{ hypervisor_cfg.username }}"
|
|
api_password: "{{ hypervisor_cfg.password }}"
|
|
community.proxmox.proxmox_kvm:
|
|
api_host: "{{ hypervisor_cfg.url }}"
|
|
api_user: "{{ hypervisor_cfg.username }}"
|
|
api_password: "{{ hypervisor_cfg.password }}"
|
|
node: "{{ hypervisor_cfg.host }}"
|
|
block:
|
|
- name: Cleanup Setup Disks
|
|
community.proxmox.proxmox_disk:
|
|
name: "{{ hostname }}"
|
|
vmid: "{{ system_cfg.id }}"
|
|
disk: "{{ item }}"
|
|
state: absent
|
|
loop: >-
|
|
{{
|
|
['ide0', 'ide2']
|
|
+ (['ide1'] if not (os == 'rhel' and system_cfg.features.rhel_repo.source == 'iso') else [])
|
|
}}
|
|
failed_when: false
|
|
no_log: true
|
|
|
|
- name: Start the VM
|
|
community.proxmox.proxmox_kvm:
|
|
vmid: "{{ system_cfg.id }}"
|
|
state: restarted
|