From 39bf187a25539013fb9ca1350127bbcaffbc956c Mon Sep 17 00:00:00 2001 From: James Harr Date: Sun, 27 Dec 2020 07:07:10 -0600 Subject: [PATCH] Proxmox - add `features` flag (#1413) * Add 'features' option to proxmox LXC Co-authored-by: Felix Fontein * Update plugins/modules/cloud/misc/proxmox.py Co-authored-by: Felix Fontein * Apply suggestions from code review Co-authored-by: Amin Vakil * Update proxmox.py Working fix * Update changelogs/fragments/1413-proxmox-features.yml Co-authored-by: Amin Vakil Co-authored-by: Felix Fontein Co-authored-by: Amin Vakil --- .../fragments/1413-proxmox-features.yml | 2 ++ plugins/modules/cloud/misc/proxmox.py | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 changelogs/fragments/1413-proxmox-features.yml diff --git a/changelogs/fragments/1413-proxmox-features.yml b/changelogs/fragments/1413-proxmox-features.yml new file mode 100644 index 0000000000..f9762b5fc9 --- /dev/null +++ b/changelogs/fragments/1413-proxmox-features.yml @@ -0,0 +1,2 @@ +minor_changes: + - proxmox - add ``features`` option to LXC (https://github.com/ansible-collections/community.general/issues/816). diff --git a/plugins/modules/cloud/misc/proxmox.py b/plugins/modules/cloud/misc/proxmox.py index c26c3f77f6..d3cfda3d92 100644 --- a/plugins/modules/cloud/misc/proxmox.py +++ b/plugins/modules/cloud/misc/proxmox.py @@ -69,6 +69,13 @@ options: description: - specifies network interfaces for the container. As a hash/dictionary defining interfaces. type: dict + features: + description: + - Specifies a list of features to be enabled. For valid options, see U(https://pve.proxmox.com/wiki/Linux_Container#pct_options). + - Some features require the use of a privileged container. + type: list + elements: str + version_added: 2.0.0 mounts: description: - specifies additional mounts (separate disks) for the container. As a hash/dictionary defining mount points @@ -270,6 +277,21 @@ EXAMPLES = r''' ostemplate: local:vztmpl/ubuntu-14.04-x86_64.tar.gz' cores: 2 +- name: Create a new container with nesting enabled and allows the use of CIFS/NFS inside the container. + community.general.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' + features: + - nesting=1 + - mount=cifs,nfs + + - name: Start container community.general.proxmox: vmid: 100 @@ -479,6 +501,7 @@ def main(): mounts=dict(type='dict'), ip_address=dict(), onboot=dict(type='bool'), + features=dict(type='list', elements='str'), storage=dict(default='local'), cpuunits=dict(type='int'), nameserver=dict(), @@ -599,6 +622,7 @@ def main(): searchdomain=module.params['searchdomain'], force=int(module.params['force']), pubkey=module.params['pubkey'], + features=",".join(module.params['features'] or []), unprivileged=int(module.params['unprivileged']), description=module.params['description'], hookscript=module.params['hookscript'])