mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-07-25 09:14:31 +00:00
Support json type for the ironic_node config_drive parameter
Since patch[0], ironic config_drive parameter support json type. [0] https://review.opendev.org/639050 Change-Id: Ieecb9e6125a182a3da41002aea26233a98aecc8c
This commit is contained in:
@@ -97,19 +97,35 @@ extends_documentation_fragment:
|
|||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Activate a node by booting an image with a configdrive attached
|
# Activate a node by booting an image with a configdrive attached
|
||||||
os_ironic_node:
|
- os_ironic_node:
|
||||||
cloud: "openstack"
|
cloud: "openstack"
|
||||||
uuid: "d44666e1-35b3-4f6b-acb0-88ab7052da69"
|
uuid: "d44666e1-35b3-4f6b-acb0-88ab7052da69"
|
||||||
state: present
|
state: present
|
||||||
power: present
|
power: present
|
||||||
deploy: True
|
deploy: True
|
||||||
maintenance: False
|
maintenance: False
|
||||||
config_drive: "http://192.168.1.1/host-configdrive.iso"
|
config_drive: "http://192.168.1.1/host-configdrive.iso"
|
||||||
instance_info:
|
instance_info:
|
||||||
image_source: "http://192.168.1.1/deploy_image.img"
|
image_source: "http://192.168.1.1/deploy_image.img"
|
||||||
image_checksum: "356a6b55ecc511a20c33c946c4e678af"
|
image_checksum: "356a6b55ecc511a20c33c946c4e678af"
|
||||||
image_disk_format: "qcow"
|
image_disk_format: "qcow"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
|
# Activate a node by booting an image with a configdrive json object
|
||||||
|
- os_ironic_node:
|
||||||
|
uuid: "d44666e1-35b3-4f6b-acb0-88ab7052da69"
|
||||||
|
auth_type: None
|
||||||
|
ironic_url: "http://192.168.1.1:6385/"
|
||||||
|
config_drive:
|
||||||
|
meta_data:
|
||||||
|
hostname: node1
|
||||||
|
public_keys:
|
||||||
|
default: ssh-rsa AAA...BBB==
|
||||||
|
instance_info:
|
||||||
|
image_source: "http://192.168.1.1/deploy_image.img"
|
||||||
|
image_checksum: "356a6b55ecc511a20c33c946c4e678af"
|
||||||
|
image_disk_format: "qcow"
|
||||||
|
delegate_to: localhost
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@@ -205,7 +221,7 @@ def main():
|
|||||||
uuid=dict(required=False),
|
uuid=dict(required=False),
|
||||||
name=dict(required=False),
|
name=dict(required=False),
|
||||||
instance_info=dict(type='dict', required=False),
|
instance_info=dict(type='dict', required=False),
|
||||||
config_drive=dict(required=False),
|
config_drive=dict(type='raw', required=False),
|
||||||
ironic_url=dict(required=False),
|
ironic_url=dict(required=False),
|
||||||
state=dict(required=False, default='present'),
|
state=dict(required=False, default='present'),
|
||||||
maintenance=dict(required=False),
|
maintenance=dict(required=False),
|
||||||
@@ -229,6 +245,13 @@ def main():
|
|||||||
endpoint=module.params['ironic_url']
|
endpoint=module.params['ironic_url']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (module.params['config_drive'] and
|
||||||
|
not isinstance(module.params['config_drive'], (str, dict))):
|
||||||
|
config_drive_type = type(module.params['config_drive'])
|
||||||
|
msg = ('argument config_drive is of type %s and we expected'
|
||||||
|
' str or dict') % config_drive_type
|
||||||
|
module.fail_json(msg=msg)
|
||||||
|
|
||||||
node_id = _choose_id_value(module)
|
node_id = _choose_id_value(module)
|
||||||
|
|
||||||
if not node_id:
|
if not node_id:
|
||||||
|
|||||||
Reference in New Issue
Block a user