1
0
Fork 0
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:
Markus 2020-05-18 07:17:11 +02:00 committed by GitHub
parent 196d3205ca
commit cd5e3e2d85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- proxmox - add the ``description`` and ``hookscript`` parameter (https://github.com/ansible-collections/community.general/pull/245).

View file

@ -129,6 +129,15 @@ options:
- Indicate if the container should be unprivileged
type: bool
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:
- Requires proxmoxer and requests modules on host. This modules can be installed with pip.
@ -148,6 +157,19 @@ EXAMPLES = r'''
hostname: example.org
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.
proxmox:
node: 'uk-mc02'
@ -443,7 +465,9 @@ def main():
force=dict(type='bool', default='no'),
state=dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']),
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'],
force=int(module.params['force']),
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']))
except Exception as e: