mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Add support for custom kernelid specification in Linode module
This commit is contained in:
parent
99ef1f3a9f
commit
312494d452
1 changed files with 17 additions and 8 deletions
|
@ -152,6 +152,11 @@ options:
|
||||||
description:
|
description:
|
||||||
- datacenter to create an instance in (Linode Datacenter)
|
- datacenter to create an instance in (Linode Datacenter)
|
||||||
default: null
|
default: null
|
||||||
|
kernel_id:
|
||||||
|
description:
|
||||||
|
- kernel to use for the instance (Linode Kernel)
|
||||||
|
default: null
|
||||||
|
version_added: "2.4"
|
||||||
wait:
|
wait:
|
||||||
description:
|
description:
|
||||||
- wait for the instance to be in state 'running' before returning
|
- wait for the instance to be in state 'running' before returning
|
||||||
|
@ -201,6 +206,7 @@ EXAMPLES = '''
|
||||||
plan: 4
|
plan: 4
|
||||||
datacenter: 2
|
datacenter: 2
|
||||||
distribution: 99
|
distribution: 99
|
||||||
|
kernel_id: 138
|
||||||
password: 'superSecureRootPassword'
|
password: 'superSecureRootPassword'
|
||||||
private_ip: yes
|
private_ip: yes
|
||||||
ssh_pub_key: 'ssh-rsa qwerty'
|
ssh_pub_key: 'ssh-rsa qwerty'
|
||||||
|
@ -331,7 +337,7 @@ def getInstanceDetails(api, server):
|
||||||
def linodeServers(module, api, state, name, alert_bwin_enabled, alert_bwin_threshold, alert_bwout_enabled, alert_bwout_threshold,
|
def linodeServers(module, api, state, name, alert_bwin_enabled, alert_bwin_threshold, alert_bwout_enabled, alert_bwout_threshold,
|
||||||
alert_bwquota_enabled, alert_bwquota_threshold, alert_cpu_enabled, alert_cpu_threshold, alert_diskio_enabled,
|
alert_bwquota_enabled, alert_bwquota_threshold, alert_cpu_enabled, alert_cpu_threshold, alert_diskio_enabled,
|
||||||
alert_diskio_threshold,backupweeklyday, backupwindow, displaygroup, plan, additional_disks, distribution,
|
alert_diskio_threshold,backupweeklyday, backupwindow, displaygroup, plan, additional_disks, distribution,
|
||||||
datacenter, linode_id, payment_term, password, private_ip, ssh_pub_key, swap, wait, wait_timeout, watchdog):
|
datacenter, kernel_id, linode_id, payment_term, password, private_ip, ssh_pub_key, swap, wait, wait_timeout, watchdog):
|
||||||
instances = []
|
instances = []
|
||||||
changed = False
|
changed = False
|
||||||
new_server = False
|
new_server = False
|
||||||
|
@ -454,12 +460,13 @@ def linodeServers(module, api, state, name, alert_bwin_enabled, alert_bwin_thres
|
||||||
arch = '64'
|
arch = '64'
|
||||||
break
|
break
|
||||||
|
|
||||||
# Get latest kernel matching arch
|
# Get latest kernel matching arch if kernel_id is not specified
|
||||||
for kernel in api.avail_kernels():
|
if not kernel_id:
|
||||||
if not kernel['LABEL'].startswith('Latest %s' % arch):
|
for kernel in api.avail_kernels():
|
||||||
continue
|
if not kernel['LABEL'].startswith('Latest %s' % arch):
|
||||||
kernel_id = kernel['KERNELID']
|
continue
|
||||||
break
|
kernel_id = kernel['KERNELID']
|
||||||
|
break
|
||||||
|
|
||||||
# Get disk list
|
# Get disk list
|
||||||
disks_id = []
|
disks_id = []
|
||||||
|
@ -607,6 +614,7 @@ def main():
|
||||||
additional_disks= dict(type='list'),
|
additional_disks= dict(type='list'),
|
||||||
distribution = dict(type='int'),
|
distribution = dict(type='int'),
|
||||||
datacenter = dict(type='int'),
|
datacenter = dict(type='int'),
|
||||||
|
kernel_id = dict(type='int'),
|
||||||
linode_id = dict(type='int', aliases=['lid']),
|
linode_id = dict(type='int', aliases=['lid']),
|
||||||
payment_term = dict(type='int', default=1, choices=[1, 12, 24]),
|
payment_term = dict(type='int', default=1, choices=[1, 12, 24]),
|
||||||
password = dict(type='str', no_log=True),
|
password = dict(type='str', no_log=True),
|
||||||
|
@ -645,6 +653,7 @@ def main():
|
||||||
additional_disks = module.params.get('additional_disks')
|
additional_disks = module.params.get('additional_disks')
|
||||||
distribution = module.params.get('distribution')
|
distribution = module.params.get('distribution')
|
||||||
datacenter = module.params.get('datacenter')
|
datacenter = module.params.get('datacenter')
|
||||||
|
kernel_id = module.params.get('kernel_id')
|
||||||
linode_id = module.params.get('linode_id')
|
linode_id = module.params.get('linode_id')
|
||||||
payment_term = module.params.get('payment_term')
|
payment_term = module.params.get('payment_term')
|
||||||
password = module.params.get('password')
|
password = module.params.get('password')
|
||||||
|
@ -674,7 +683,7 @@ def main():
|
||||||
alert_bwquota_enabled, alert_bwquota_threshold, alert_cpu_enabled,
|
alert_bwquota_enabled, alert_bwquota_threshold, alert_cpu_enabled,
|
||||||
alert_cpu_threshold, alert_diskio_enabled, alert_diskio_threshold,
|
alert_cpu_threshold, alert_diskio_enabled, alert_diskio_threshold,
|
||||||
backupweeklyday, backupwindow, displaygroup, plan,
|
backupweeklyday, backupwindow, displaygroup, plan,
|
||||||
additional_disks, distribution, datacenter, linode_id,
|
additional_disks, distribution, datacenter, kernel_id, linode_id,
|
||||||
payment_term, password, private_ip, ssh_pub_key, swap, wait,
|
payment_term, password, private_ip, ssh_pub_key, swap, wait,
|
||||||
wait_timeout, watchdog)
|
wait_timeout, watchdog)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue