|
|
|
@ -37,12 +37,12 @@ options:
|
|
|
|
|
description:
|
|
|
|
|
- Password of login user
|
|
|
|
|
required: true
|
|
|
|
|
default: True
|
|
|
|
|
default: 'yes'
|
|
|
|
|
login_tenant_name:
|
|
|
|
|
description:
|
|
|
|
|
- The tenant name of the login user
|
|
|
|
|
required: true
|
|
|
|
|
default: True
|
|
|
|
|
default: 'yes'
|
|
|
|
|
auth_url:
|
|
|
|
|
description:
|
|
|
|
|
- The keystone url for authentication
|
|
|
|
@ -213,9 +213,11 @@ def main():
|
|
|
|
|
|
|
|
|
|
quantum = _get_quantum_client(module, module.params)
|
|
|
|
|
_set_tenant_id(module)
|
|
|
|
|
|
|
|
|
|
router_id = _get_router_id(module, quantum)
|
|
|
|
|
if not router_id:
|
|
|
|
|
module.fail_json(msg="failed to get the router id, please check the router name")
|
|
|
|
|
|
|
|
|
|
subnet_id = _get_subnet_id(module, quantum)
|
|
|
|
|
if not subnet_id:
|
|
|
|
|
module.fail_json(msg="failed to get the subnet id, please check the subnet name")
|
|
|
|
@ -226,6 +228,7 @@ def main():
|
|
|
|
|
_add_interface_router(quantum, module, router_id, subnet_id)
|
|
|
|
|
module.exit_json(changed=True, result="created", id=port_id)
|
|
|
|
|
module.exit_json(changed=False, result="success", id=port_id)
|
|
|
|
|
|
|
|
|
|
if module.params['state'] == 'absent':
|
|
|
|
|
port_id = _get_port_id(quantum, module, router_id, subnet_id)
|
|
|
|
|
if not port_id:
|
|
|
|
@ -233,8 +236,6 @@ def main():
|
|
|
|
|
_remove_interface_router(quantum, module, router_id, subnet_id)
|
|
|
|
|
module.exit_json(changed=True, result="Deleted")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# this is magic, see lib/ansible/module.params['common.py
|
|
|
|
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
|
|
|
|
main()
|
|
|
|
|