New in version 2.0.
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)
parameter | required | default | choices | comments |
---|---|---|---|---|
api_host | yes | the host of the Proxmox VE cluster |
||
api_password | no |
the password to authenticate with
you can use PROXMOX_PASSWORD environment variable
|
||
api_user | yes | the user to authenticate with |
||
cpus | no | 1 | numbers of allocated cpus for instance |
|
cpuunits | no | 1000 | CPU weight for a VM |
|
disk | no | 3 | hard disk size in GB for instance |
|
force | no |
forcing operations
can be used only with states
present , stopped , restarted
with
state=present force option allow to overwrite existing containerwith states
stopped , restarted allow to force stop instance |
||
hostname | no |
the instance hostname
required only for
state=present
|
||
ip_address | no | specifies the address the container will be assigned |
||
memory | no | 512 | memory size in MB for instance |
|
mounts (added in 2.2)
| no | specifies additional mounts (separate disks) for the container |
||
nameserver | no | sets DNS server IP address for a container |
||
netif | no | specifies network interfaces for the container |
||
node | no |
Proxmox VE node, when new VM will be created
required only for
state=present
for another states will be autodiscovered
|
||
onboot | no | specifies whether a VM will be started during system bootup |
||
ostemplate | no |
the template for VM creating
required only for
state=present
|
||
password | no |
the instance root password
required only for
state=present
|
||
pool (added in 2.3)
| no | Proxmox VE resource pool |
||
searchdomain | no | sets DNS search domain for a container |
||
state | no | present |
| Indicate desired state of the instance |
storage | no | local | target storage |
|
swap | no | swap memory size in MB for instance |
||
timeout | no | 30 | timeout for operations |
|
validate_certs | no | enable / disable https certificate verification |
||
vmid | yes | the instance id |
# Create new container with minimal options - proxmox: vmid=100 node='uk-mc02' api_user='[email protected]' 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='[email protected]' 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='[email protected]' 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='[email protected]' 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='[email protected]' 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='[email protected]' 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='[email protected]' api_password='1q2w3e' api_host='node1' state=started # Stop container - proxmox: vmid=100 api_user='[email protected]' api_password='1q2w3e' api_host='node1' state=stopped # Stop container with force - proxmox: vmid=100 api_user='[email protected]' 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='[email protected]' api_password='1q2w3e' api_host='node1' state=stopped # Remove container - proxmox: vmid=100 api_user='[email protected]' api_password='1q2w3e' api_host='node1' state=absent
Note
Requires proxmoxer and requests modules on host. This modules can be installed with pip.
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.
© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/proxmox_module.html