Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ostype parameter in LXC container clone of Proxmox VE #7462

Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions plugins/modules/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@
- target storage
type: str
default: 'local'
ostype:
description:
- specifies the ostype of the lxc container
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
choices: ['auto', 'debian', 'devuan', 'ubuntu', 'centos', 'fedora', 'opensuse', 'archlinux', 'alpine', 'gentoo', 'nixos', 'unmanaged']
type: str
default: 'auto'
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
cpuunits:
description:
- CPU weight for a VM
Expand Down Expand Up @@ -497,6 +503,10 @@ def create_instance(self, vmid, node, disk, storage, cpus, memory, swap, timeout
self.module.fail_json(msg='%s is not a valid tag' % tag)
kwargs['tags'] = ",".join(kwargs['tags'])

if 'ostype' in kwargs:
if kwargs['ostype'] == 'auto':
kwargs.pop('ostype')
felixfontein marked this conversation as resolved.
Show resolved Hide resolved

if clone is not None:
if VZ_TYPE != 'lxc':
self.module.fail_json(changed=False, msg="Clone operator is only supported for LXC enabled proxmox clusters.")
Expand Down Expand Up @@ -612,6 +622,9 @@ def main():
netif=dict(type='dict'),
mounts=dict(type='dict'),
ip_address=dict(),
ostype=dict(default='auto', choices=[
'auto', 'debian', 'devuan', 'ubuntu', 'centos', 'fedora', 'opensuse', 'archlinux', 'alpine', 'gentoo', 'nixos', 'unmanaged'
]),
onboot=dict(type='bool'),
features=dict(type='list', elements='str'),
storage=dict(default='local'),
Expand Down Expand Up @@ -719,6 +732,7 @@ def main():
ostemplate=module.params['ostemplate'],
netif=module.params['netif'],
mounts=module.params['mounts'],
ostype=module.params['ostype'],
ip_address=module.params['ip_address'],
onboot=ansible_to_proxmox_bool(module.params['onboot']),
cpuunits=module.params['cpuunits'],
Expand Down