The vmware_cfg_backup module

Using this module, you can create a backup of a VMware ESXi host configuration:

- name: Create an esxi host configuration backup  vmware_cfg_backup:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    state: "saved"    dest: "/tmp/"    esxi_hostname: "{{ exsi_host }}"  delegate_to: "localhost"  register: cfg_backup

Please note that this module will automatically put the host into maintenance and then save the configuration too. In the preceding example, from /tmp, you can use the information registered to grab a copy of the backup using the fetch module.

You can also use this module to restore a configuration:

- name: Restore an esxi host configuration ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.