??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
σ
ίUdac @` sW d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d d
l Z d d
l
Z
d d
l Z d d l m
Z
y d d l m Z e Z Wn e k
r³ e Z n Xd d
l m Z d d l m Z d
a d Z d Z d Z d Z d Z d Z d Z d Z! d Z" d Z# d Z$ e% d k rSe$ n d
S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys;
---
module: proxmox
short_description: management of instances in Proxmox VE cluster
description:
- 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)
version_added: "2.0"
options:
api_host:
description:
- the host of the Proxmox VE cluster
required: true
api_user:
description:
- the user to authenticate with
required: true
api_password:
description:
- the password to authenticate with
- you can use PROXMOX_PASSWORD environment variable
vmid:
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
validate_certs:
description:
- enable / disable https certificate verification
type: bool
default: 'no'
node:
description:
- Proxmox VE node, when new VM will be created
- required only for C(state=present)
- for another states will be autodiscovered
pool:
description:
- Proxmox VE resource pool
version_added: "2.3"
password:
description:
- the instance root password
- required only for C(state=present)
hostname:
description:
- the instance hostname
- required only for C(state=present)
- must be unique if vmid is not passed
ostemplate:
description:
- the template for VM creating
- required only for C(state=present)
disk:
description:
- hard disk size in GB for instance
default: 3
cores:
description:
- Specify number of cores per socket.
default: 1
version_added: 2.4
cpus:
description:
- numbers of allocated cpus for instance
default: 1
memory:
description:
- memory size in MB for instance
default: 512
swap:
description:
- swap memory size in MB for instance
default: 0
netif:
description:
- specifies network interfaces for the container. As a hash/dictionary defining interfaces.
mounts:
description:
- specifies additional mounts (separate disks) for the container. As a hash/dictionary defining mount points
version_added: "2.2"
ip_address:
description:
- specifies the address the container will be assigned
onboot:
description:
- specifies whether a VM will be started during system bootup
type: bool
default: 'no'
storage:
description:
- target storage
default: 'local'
cpuunits:
description:
- CPU weight for a VM
default: 1000
nameserver:
description:
- sets DNS server IP address for a container
searchdomain:
description:
- sets DNS search domain for a container
timeout:
description:
- timeout for operations
default: 30
force:
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
type: bool
default: 'no'
state:
description:
- Indicate desired state of the instance
choices: ['present', 'started', 'absent', 'stopped', 'restarted']
default: present
pubkey:
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"
unprivileged:
version_added: "2.3"
description:
- Indicate if the container should be unprivileged
type: bool
default: 'no'
notes:
- Requires proxmoxer and requests modules on host. This modules can be installed with pip.
requirements: [ "proxmoxer", "python >= 2.7", "requests" ]
author: Sergei Antipov (@UnderGreen)
sΤ
# 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 with 8GB
- 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/"}'
# Create new container with minimal options defining a cpu core limit
- 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'
cores: 2
# Start container
- proxmox:
vmid: 100
api_user: root@pam
api_password: 1q2w3e
api_host: node1
state: started
# Start container with mount. You should enter a 90-second timeout because servers with additional disks take longer to boot.
- proxmox:
vmid: 100
api_user: root@pam
api_password: 1q2w3e
api_host: node1
state: started
timeout: 90
# 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: restarted
# Remove container
- proxmox:
vmid: 100
api_user: root@pam
api_password: 1q2w3e
api_host: node1
state: absent
N( t LooseVersion( t
ProxmoxAPI( t
AnsibleModule( t to_nativec C` sZ y | j j j } | SWn9 t k
rU } | j d d t | d t j n Xd S( Nt msgs2 Unable to get next vmid. Failed with exception: %st exception( t clustert nextidt gett Exceptiont fail_jsonR t tracebackt
format_exc( t modulet proxmoxt vmidt e( ( sF /usr/lib/python2.7/site-packages/ansible/modules/cloud/misc/proxmox.pyt get_nextvmid7 s c C` sI g | j j j d d D], } d | k r | d | k r | d ^ q S( Nt typet vmt nameR ( R t resourcesR ( R t hostnameR ( ( sF /usr/lib/python2.7/site-packages/ansible/modules/cloud/misc/proxmox.pyt get_vmid@ s c C` s? g | j j j d d D]" } | d t | k r | ^ q S( NR R R ( R R R t int( R R R ( ( sF /usr/lib/python2.7/site-packages/ansible/modules/cloud/misc/proxmox.pyt get_instanceD s c C` sB g | j | j | j j D] } | d | k r" t ^ q" S( Nt volid( t nodest storaget contentR t True( R t nodet
ostemplatet template_storet cnt( ( sF /usr/lib/python2.7/site-packages/ansible/modules/cloud/misc/proxmox.pyt
content_checkH s c C` s0 g | j j D] } | d | k r t ^ q S( NR' ( R# R R&