community.vmware.vmware_cfg_backup (4.2.0) — module

Backup / Restore / Reset ESXi host configuration

Authors: Andreas Nafpliotis (@nafpliot-ibm)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

This module can be used to perform various operations related to backup, restore and reset of ESXi host configuration.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Save the ESXi configuration locally by authenticating directly against the ESXi host
  community.vmware.vmware_cfg_backup:
    hostname: '{{ esxi_hostname }}'
    username: '{{ esxi_username }}'
    password: '{{ esxi_password }}'
    state: saved
    dest: /tmp/
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Save the ESXi configuration locally by authenticating against the vCenter and selecting the ESXi host
  community.vmware.vmware_cfg_backup:
    hostname: '{{ vcenter_hostname }}'
    esxi_hostname: '{{ esxi_hostname }}'
    username: '{{ esxi_username }}'
    password: '{{ esxi_password }}'
    state: saved
    dest: /tmp/
  delegate_to: localhost

Inputs

    
src:
    description:
    - The file containing the ESXi configuration that will be restored.
    type: path

dest:
    description:
    - The destination where the ESXi configuration bundle will be saved. Can be a folder
      or a file.
    - If a folder, the backup file will be saved in the folder with the default filename
      generated from the ESXi server.
    - If a file, the backup file will be saved with that filename. The file extension
      will always be .tgz.
    type: path

port:
    default: 443
    description:
    - The port number of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT)
      will be used instead.
    type: int

state:
    choices:
    - saved
    - absent
    - loaded
    description:
    - If V(saved), the .tgz backup bundle will be saved in O(dest).
    - If V(absent), the host configuration will be reset to default values.
    - If V(loaded), the backup file in O(src) will be loaded to the ESXi host rewriting
      the hosts settings.
    required: true
    type: str

hostname:
    description:
    - The hostname or IP address of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST)
      will be used instead.
    type: str

password:
    aliases:
    - pass
    - pwd
    description:
    - The password of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD)
      will be used instead.
    type: str

username:
    aliases:
    - admin
    - user
    description:
    - The username of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_USER)
      will be used instead.
    type: str

proxy_host:
    description:
    - Address of a proxy that will receive all HTTPS requests and relay them.
    - The format is a hostname or a IP.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST)
      will be used instead.
    required: false
    type: str

proxy_port:
    description:
    - Port of the HTTP proxy that will receive all HTTPS requests and relay them.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

esxi_hostname:
    description:
    - Name of ESXi server. This is required only if authentication against a vCenter is
      done.
    required: false
    type: str

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to V(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS)
      will be used instead.
    type: bool

Outputs

dest_file:
  description: The full path of where the file holding the ESXi configurations was
    stored
  returned: changed
  sample: /tmp/configBundle-esxi.host.domain.tgz
  type: str