|
|
@ -40,7 +40,7 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- password of login user
|
|
|
|
- password of login user
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
default: True
|
|
|
|
default: 'yes'
|
|
|
|
login_tenant_name:
|
|
|
|
login_tenant_name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the tenant name of the login user
|
|
|
|
- the tenant name of the login user
|
|
|
@ -163,8 +163,8 @@ def _update_floating_ip(quantum, module, port_id, floating_ip_id):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
result = quantum.update_floatingip(floating_ip_id, {'floatingip': kwargs})
|
|
|
|
result = quantum.update_floatingip(floating_ip_id, {'floatingip': kwargs})
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
module.fail_json( msg = "There was an error in updating the floating ip address: %s" % e.message)
|
|
|
|
module.fail_json(msg = "There was an error in updating the floating ip address: %s" % e.message)
|
|
|
|
module.exit_json( changed = True, result = result, public_ip=module.params['ip_address'])
|
|
|
|
module.exit_json(changed = True, result = result, public_ip=module.params['ip_address'])
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
|
|
|
|
|
|
|
@ -192,7 +192,7 @@ def main():
|
|
|
|
module.exit_json(changed = False, result = 'attached', public_ip=module.params['ip_address'])
|
|
|
|
module.exit_json(changed = False, result = 'attached', public_ip=module.params['ip_address'])
|
|
|
|
server_info, server_obj = _get_server_state(module, nova)
|
|
|
|
server_info, server_obj = _get_server_state(module, nova)
|
|
|
|
if not server_info:
|
|
|
|
if not server_info:
|
|
|
|
module.fail_json( msg = " The instance name provided cannot be found")
|
|
|
|
module.fail_json(msg = " The instance name provided cannot be found")
|
|
|
|
port_id = _get_port_id(quantum, module, server_info['id'])
|
|
|
|
port_id = _get_port_id(quantum, module, server_info['id'])
|
|
|
|
if not port_id:
|
|
|
|
if not port_id:
|
|
|
|
module.fail_json(msg = "Cannot find a port for this instance, maybe fixed ip is not assigned")
|
|
|
|
module.fail_json(msg = "Cannot find a port for this instance, maybe fixed ip is not assigned")
|
|
|
@ -203,7 +203,8 @@ def main():
|
|
|
|
module.exit_json(changed = False, result = 'detached')
|
|
|
|
module.exit_json(changed = False, result = 'detached')
|
|
|
|
if state == 'attached':
|
|
|
|
if state == 'attached':
|
|
|
|
_update_floating_ip(quantum, module, None, floating_ip_id)
|
|
|
|
_update_floating_ip(quantum, module, None, floating_ip_id)
|
|
|
|
module.exit_json( changed = True, result = "detached")
|
|
|
|
module.exit_json(changed = True, result = "detached")
|
|
|
|
|
|
|
|
|
|
|
|
# this is magic, see lib/ansible/module.params['common.py
|
|
|
|
# this is magic, see lib/ansible/module.params['common.py
|
|
|
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
|
|
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|