support for cloud-init on pve

This commit is contained in:
Sergey Bubnov (omg) 2019-06-26 16:20:56 +04:00
parent 71791cd3d6
commit b242e30184
2 changed files with 27 additions and 0 deletions

View File

@ -150,6 +150,21 @@ options:
- C(storage) is the storage identifier where to create the disk. - C(storage) is the storage identifier where to create the disk.
- C(size) is the size of the disk in GB. - C(size) is the size of the disk in GB.
- C(format) is the drive's backing file's data format. C(qcow2|raw|subvol). - C(format) is the drive's backing file's data format. C(qcow2|raw|subvol).
ipconfig:
description:
- cloud-init: Specify IP addresses and gateways for the corresponding interface.
- IP addresses use CIDR notation, gateways are optional but need an IP of the same type specified.
- The special string 'dhcp' can be used for IP addresses to use DHCP, in which case no explicit gateway should be provided.
- For IPv6 the special string 'auto' can be used to use stateless autoconfiguration.
- If cloud-init is enabled and neither an IPv4 nor an IPv6 address is specified, it defaults to using dhcp on IPv4.
sshkeys:
description:
- string with public ssh keys; one key per line
nameserver:
description:
- nameserver ip address
searchdomain:
- domain to search in
keyboard: keyboard:
description: description:
- Sets the keyboard layout for VNC server. - Sets the keyboard layout for VNC server.
@ -825,6 +840,10 @@ def main():
hotplug=dict(type='str'), hotplug=dict(type='str'),
hugepages=dict(choices=['any', '2', '1024']), hugepages=dict(choices=['any', '2', '1024']),
ide=dict(type='dict', default=None), ide=dict(type='dict', default=None),
ipconfig0=dict(type='str', default=None),
sshkeys=dict(type='str', default=None),
nameserver=dict(type='str', default=None),
searchdomain=dict(type='str', default=None),
keyboard=dict(type='str'), keyboard=dict(type='str'),
kvm=dict(type='bool', default='yes'), kvm=dict(type='bool', default='yes'),
localtime=dict(type='bool'), localtime=dict(type='bool'),
@ -993,6 +1012,10 @@ def main():
hotplug=module.params['hotplug'], hotplug=module.params['hotplug'],
hugepages=module.params['hugepages'], hugepages=module.params['hugepages'],
ide=module.params['ide'], ide=module.params['ide'],
ipconfig0=module.params['ipconfig0'],
sshkeys=module.params['sshkeys'],
nameserver=module.params['nameserver'],
searchdomain=module.params['searchdomain'],
keyboard=module.params['keyboard'], keyboard=module.params['keyboard'],
kvm=module.params['kvm'], kvm=module.params['kvm'],
localtime=module.params['localtime'], localtime=module.params['localtime'],

View File

@ -47,6 +47,10 @@
net: "{{stack.nodes[node_name].net | to_proxmox_net}}" net: "{{stack.nodes[node_name].net | to_proxmox_net}}"
update: yes update: yes
state: present state: present
# ide: '{ide[2]: "local-lvm:cloudinit"}'
ipconfig0: "ip={{stack.nodes[node_name].net.eth0.ipv4[0]}},gw={{stack.nodes[node_name].net.eth0.default}}"
nameserver: "{{stack.nodes[node_name].net.eth0.nameservers[0]}}"
searchdomain: "{{stack.nodes[node_name].net.eth0.search[0]}}"
register: vm_status register: vm_status
until: vm_status is succeeded until: vm_status is succeeded
retries: 30 retries: 30