Add playbooks/xcp_xo_vm_snapshot.yml
This commit is contained in:
23
playbooks/xcp_xo_vm_snapshot.yml
Normal file
23
playbooks/xcp_xo_vm_snapshot.yml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- name: Create VM Snapshot via Xen Orchestra
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
vm_name: "target_vm_name"
|
||||||
|
snapshot_name: "backup_{{ ansible_date_time.iso8601_basic_short }}"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Create snapshot of {{ vm_name }}
|
||||||
|
community.general.xen_orchestra_vm:
|
||||||
|
api_url: "{{ xo_host }}"
|
||||||
|
api_user: "{{ xo_user }}"
|
||||||
|
api_password: "{{ xo_password }}"
|
||||||
|
validate_certs: "{{ xo_validate_certs }}"
|
||||||
|
name: "{{ vm_name }}"
|
||||||
|
snapshot: yes
|
||||||
|
snapshot_name: "{{ snapshot_name }}"
|
||||||
|
register: snap_result
|
||||||
|
|
||||||
|
- name: Debug Snapshot Info
|
||||||
|
debug:
|
||||||
|
msg: "Snapshot {{ snapshot_name }} created for {{ vm_name }}"
|
||||||
Reference in New Issue
Block a user