26 lines
No EOL
708 B
YAML
26 lines
No EOL
708 B
YAML
---
|
|
# Migrate template from local-lvm to ceph storage
|
|
|
|
- name: Migrate template to Ceph storage
|
|
hosts: proxmox[0]
|
|
become: yes
|
|
vars:
|
|
template_vmid: 9000
|
|
|
|
tasks:
|
|
- name: Check if template exists
|
|
shell: |
|
|
qm status {{ template_vmid }} >/dev/null 2>&1 && echo "exists" || echo "missing"
|
|
register: template_check
|
|
changed_when: false
|
|
|
|
- name: Stop and destroy existing template
|
|
shell: |
|
|
qm destroy {{ template_vmid }} --purge
|
|
when: template_check.stdout == "exists"
|
|
|
|
- name: Recreate template on Ceph
|
|
ansible.builtin.include_tasks:
|
|
file: create-vm-template.yml
|
|
apply:
|
|
delegate_to: "{{ inventory_hostname }}" |