mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Implement mounts in proxmox module (#2426)
* 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
This commit is contained in:
parent
b32c550e22
commit
e235f88a91
1 changed files with 15 additions and 0 deletions
|
@ -99,6 +99,13 @@ options:
|
||||||
default: null
|
default: null
|
||||||
required: false
|
required: false
|
||||||
type: A hash/dictionary defining interfaces
|
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:
|
ip_address:
|
||||||
description:
|
description:
|
||||||
- specifies the address the container will be assigned
|
- specifies the address the container will be assigned
|
||||||
|
@ -174,6 +181,9 @@ EXAMPLES = '''
|
||||||
# Create new container with minimal options defining network interface with dhcp
|
# 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"}'
|
- 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
|
# Start container
|
||||||
- proxmox: vmid=100 api_user='root@pam' api_password='1q2w3e' api_host='node1' state=started
|
- 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:
|
if 'netif' in kwargs:
|
||||||
kwargs.update(kwargs['netif'])
|
kwargs.update(kwargs['netif'])
|
||||||
del kwargs['netif']
|
del kwargs['netif']
|
||||||
|
if 'mounts' in kwargs:
|
||||||
|
kwargs.update(kwargs['mounts'])
|
||||||
|
del kwargs['mounts']
|
||||||
else:
|
else:
|
||||||
kwargs['cpus']=cpus
|
kwargs['cpus']=cpus
|
||||||
kwargs['disk']=disk
|
kwargs['disk']=disk
|
||||||
|
@ -298,6 +311,7 @@ def main():
|
||||||
memory = dict(type='int', default=512),
|
memory = dict(type='int', default=512),
|
||||||
swap = dict(type='int', default=0),
|
swap = dict(type='int', default=0),
|
||||||
netif = dict(type='dict'),
|
netif = dict(type='dict'),
|
||||||
|
mounts = dict(type='dict'),
|
||||||
ip_address = dict(),
|
ip_address = dict(),
|
||||||
onboot = dict(type='bool', default='no'),
|
onboot = dict(type='bool', default='no'),
|
||||||
storage = dict(default='local'),
|
storage = dict(default='local'),
|
||||||
|
@ -359,6 +373,7 @@ def main():
|
||||||
hostname = module.params['hostname'],
|
hostname = module.params['hostname'],
|
||||||
ostemplate = module.params['ostemplate'],
|
ostemplate = module.params['ostemplate'],
|
||||||
netif = module.params['netif'],
|
netif = module.params['netif'],
|
||||||
|
mounts = module.params['mounts'],
|
||||||
ip_address = module.params['ip_address'],
|
ip_address = module.params['ip_address'],
|
||||||
onboot = int(module.params['onboot']),
|
onboot = int(module.params['onboot']),
|
||||||
cpuunits = module.params['cpuunits'],
|
cpuunits = module.params['cpuunits'],
|
||||||
|
|
Loading…
Reference in a new issue