From e235f88a91f8c756e9734a8be83a6c1360ad6b57 Mon Sep 17 00:00:00 2001 From: Baptiste Mille-Mathias Date: Fri, 17 Jun 2016 14:50:15 +0200 Subject: [PATCH] Implement mounts in proxmox module (#2426) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement mounts in proxmox module mounts in proxmox are the additionnal disk devices set in a guests. We handle the mounts the same way that netif devices, using a dictionnary with keys being mp0, mp1,… * Add version_added Seems to be a requirement but I didn't see that anywhere. Hope it'll fix the travis-ci issue --- lib/ansible/modules/extras/cloud/misc/proxmox.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/ansible/modules/extras/cloud/misc/proxmox.py b/lib/ansible/modules/extras/cloud/misc/proxmox.py index bd73a037c2..f02ff2e292 100644 --- a/lib/ansible/modules/extras/cloud/misc/proxmox.py +++ b/lib/ansible/modules/extras/cloud/misc/proxmox.py @@ -99,6 +99,13 @@ options: default: null required: false type: A hash/dictionary defining interfaces + mounts: + description: + - specifies additional mounts (separate disks) for the container + default: null + required: false + type: A hash/dictionary defining mount points + version_added: "2.2" ip_address: description: - specifies the address the container will be assigned @@ -174,6 +181,9 @@ EXAMPLES = ''' # 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 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 @@ -219,6 +229,9 @@ def create_instance(module, proxmox, vmid, node, disk, storage, cpus, memory, sw if 'netif' in kwargs: kwargs.update(kwargs['netif']) del kwargs['netif'] + if 'mounts' in kwargs: + kwargs.update(kwargs['mounts']) + del kwargs['mounts'] else: kwargs['cpus']=cpus kwargs['disk']=disk @@ -298,6 +311,7 @@ def main(): memory = dict(type='int', default=512), swap = dict(type='int', default=0), netif = dict(type='dict'), + mounts = dict(type='dict'), ip_address = dict(), onboot = dict(type='bool', default='no'), storage = dict(default='local'), @@ -359,6 +373,7 @@ def main(): hostname = module.params['hostname'], ostemplate = module.params['ostemplate'], netif = module.params['netif'], + mounts = module.params['mounts'], ip_address = module.params['ip_address'], onboot = int(module.params['onboot']), cpuunits = module.params['cpuunits'],