ansible / ansible.builtin / v2.3.2.0-1 / module / proxmox management of instances in Proxmox VE cluster | "added in version" 2.0 of ansible.builtin" Authors: Sergei Antipov @UnderGreen preview | supported by communityansible.builtin.proxmox (v2.3.2.0-1) — module
pip
Install with pip install ansible==2.3.2.0.post1
allows you to create/delete/stop instances in Proxmox VE cluster
Starting in Ansible 2.1, it automatically detects containerization type (lxc for PVE 4, openvz for older)
# Create new container with minimal options - proxmox: vmid: 100 node: uk-mc02 api_user: root@pam api_password: 1q2w3e api_host: node1 password: 123456 hostname: example.org ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
# Create new container automatically selecting the next available vmid. - proxmox: node='uk-mc02' api_user='root@pam' api_password='1q2w3e' api_host='node1' password='123456' hostname='example.org' ostemplate='local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
# Create new container with minimal options with force(it will rewrite existing container) - proxmox: vmid: 100 node: uk-mc02 api_user: root@pam api_password: 1q2w3e api_host: node1 password: 123456 hostname: example.org ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz' force: yes
# Create new container with minimal options use environment PROXMOX_PASSWORD variable(you should export it before) - proxmox: vmid: 100 node: uk-mc02 api_user: root@pam api_host: node1 password: 123456 hostname: example.org ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
# Create new container with minimal options defining network interface with dhcp - proxmox: vmid: 100 node: uk-mc02 api_user: root@pam api_password: 1q2w3e api_host: node1 password: 123456 hostname: example.org ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz' netif: '{"net0":"name=eth0,ip=dhcp,ip6=dhcp,bridge=vmbr0"}'
# Create new container with minimal options defining network interface with static ip - proxmox: vmid: 100 node: uk-mc02 api_user: root@pam api_password: 1q2w3e api_host: node1 password: 123456 hostname: example.org ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz' netif: '{"net0":"name=eth0,gw=192.168.0.1,ip=192.168.0.2/24,bridge=vmbr0"}'
# Create new container with minimal options defining a mount - proxmox: vmid: 100 node: uk-mc02 api_user: root@pam api_password: 1q2w3e api_host: node1 password: 123456 hostname: example.org ostemplate: local:vztmpl/ubuntu-14.04-x86_64.tar.gz' mounts: '{"mp0":"local:8,mp=/mnt/test/"}'
# Start container - proxmox: vmid: 100 api_user: root@pam api_password: 1q2w3e api_host: node1 state: started
# Stop container - proxmox: vmid: 100 api_user: root@pam api_password: 1q2w3e api_host: node1 state: stopped
# Stop container with force - proxmox: vmid: 100 api_user: root@pam api_password: 1q2w3e api_host: node1 force: yes state: stopped
# Restart container(stopped or mounted container you can't restart) - proxmox: vmid: 100 api_user: root@pam api_password: 1q2w3e api_host: node1 state: stopped
# Remove container - proxmox: vmid: 100 api_user: root@pam api_password: 1q2w3e api_host: node1 state: absent
cpus: default: 1 description: - numbers of allocated cpus for instance required: false disk: default: 3 description: - hard disk size in GB for instance required: false node: default: null description: - Proxmox VE node, when new VM will be created - required only for C(state=present) - for another states will be autodiscovered required: false pool: default: null description: - Proxmox VE resource pool required: false version_added: '2.3' version_added_collection: ansible.builtin swap: default: 0 description: - swap memory size in MB for instance required: false vmid: default: null description: - the instance id - if not set, the next available VM ID will be fetched from ProxmoxAPI. - if not set, will be fetched from PromoxAPI based on the hostname required: false force: default: false description: - forcing operations - can be used only with states C(present), C(stopped), C(restarted) - with C(state=present) force option allow to overwrite existing container - with states C(stopped) , C(restarted) allow to force stop instance required: false type: bool netif: default: null description: - specifies network interfaces for the container. As a hash/dictionary defining interfaces. required: false state: choices: - present - started - absent - stopped - restarted default: present description: - Indicate desired state of the instance memory: default: 512 description: - memory size in MB for instance required: false mounts: default: null description: - specifies additional mounts (separate disks) for the container. As a hash/dictionary defining mount points required: false version_added: '2.2' version_added_collection: ansible.builtin onboot: default: false description: - specifies whether a VM will be started during system bootup required: false pubkey: default: null description: - Public key to add to /root/.ssh/authorized_keys. This was added on Proxmox 4.2, it is ignored for earlier versions version_added: '2.3' version_added_collection: ansible.builtin storage: default: local description: - target storage required: false timeout: default: 30 description: - timeout for operations required: false api_host: description: - the host of the Proxmox VE cluster required: true api_user: description: - the user to authenticate with required: true cpuunits: default: 1000 description: - CPU weight for a VM required: false hostname: default: null description: - the instance hostname - required only for C(state=present) - must be unique if vmid is not passed required: false password: default: null description: - the instance root password - required only for C(state=present) required: false ip_address: default: null description: - specifies the address the container will be assigned required: false nameserver: default: null description: - sets DNS server IP address for a container required: false ostemplate: default: null description: - the template for VM creating - required only for C(state=present) required: false api_password: default: null description: - the password to authenticate with - you can use PROXMOX_PASSWORD environment variable required: false searchdomain: default: null description: - sets DNS search domain for a container required: false unprivileged: default: false description: - Indicate if the container should be unprivileged required: false version_added: '2.3' version_added_collection: ansible.builtin validate_certs: default: false description: - enable / disable https certificate verification required: false type: bool