mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add description and hookscript parameters to proxmox LXC container (#245)
* add description and hookscript parameters to proxmox LXC container * fix pep8 E128 * Update plugins/modules/cloud/misc/proxmox.py Co-Authored-By: Andrew Klychkov <aaklychkov@mail.ru> * Update plugins/modules/cloud/misc/proxmox.py Co-Authored-By: Andrew Klychkov <aaklychkov@mail.ru> * add example for proxmox hookscript and description * add changelogs fragment for PR #245 * set hookscript type Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
196d3205ca
commit
cd5e3e2d85
2 changed files with 30 additions and 2 deletions
2
changelogs/fragments/245-proxmox.yml
Normal file
2
changelogs/fragments/245-proxmox.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- proxmox - add the ``description`` and ``hookscript`` parameter (https://github.com/ansible-collections/community.general/pull/245).
|
|
@ -129,6 +129,15 @@ options:
|
||||||
- Indicate if the container should be unprivileged
|
- Indicate if the container should be unprivileged
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
|
description:
|
||||||
|
description:
|
||||||
|
- Specify the description for the container. Only used on the configuration web interface.
|
||||||
|
- This is saved as a comment inside the configuration file.
|
||||||
|
type: str
|
||||||
|
hookscript:
|
||||||
|
description:
|
||||||
|
- Script that will be executed during various steps in the containers lifetime.
|
||||||
|
type: str
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
- Requires proxmoxer and requests modules on host. This modules can be installed with pip.
|
- Requires proxmoxer and requests modules on host. This modules can be installed with pip.
|
||||||
|
@ -148,6 +157,19 @@ EXAMPLES = r'''
|
||||||
hostname: example.org
|
hostname: example.org
|
||||||
ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
|
ostemplate: 'local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
|
||||||
|
|
||||||
|
- name: Create new container with hookscript and description
|
||||||
|
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'
|
||||||
|
hookscript: 'local:snippets/vm_hook.sh'
|
||||||
|
description: created with ansible
|
||||||
|
|
||||||
- name: Create new container automatically selecting the next available vmid.
|
- name: Create new container automatically selecting the next available vmid.
|
||||||
proxmox:
|
proxmox:
|
||||||
node: 'uk-mc02'
|
node: 'uk-mc02'
|
||||||
|
@ -443,7 +465,9 @@ def main():
|
||||||
force=dict(type='bool', default='no'),
|
force=dict(type='bool', default='no'),
|
||||||
state=dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']),
|
state=dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']),
|
||||||
pubkey=dict(type='str', default=None),
|
pubkey=dict(type='str', default=None),
|
||||||
unprivileged=dict(type='bool', default='no')
|
unprivileged=dict(type='bool', default='no'),
|
||||||
|
description=dict(type='str'),
|
||||||
|
hookscript=dict(type='str'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -524,7 +548,9 @@ def main():
|
||||||
searchdomain=module.params['searchdomain'],
|
searchdomain=module.params['searchdomain'],
|
||||||
force=int(module.params['force']),
|
force=int(module.params['force']),
|
||||||
pubkey=module.params['pubkey'],
|
pubkey=module.params['pubkey'],
|
||||||
unprivileged=int(module.params['unprivileged']))
|
unprivileged=int(module.params['unprivileged']),
|
||||||
|
description=module.params['description'],
|
||||||
|
hookscript=module.params['hookscript'])
|
||||||
|
|
||||||
module.exit_json(changed=True, msg="deployed VM %s from template %s" % (vmid, module.params['ostemplate']))
|
module.exit_json(changed=True, msg="deployed VM %s from template %s" % (vmid, module.params['ostemplate']))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in a new issue