|
|
|
@ -38,12 +38,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
|
|
|
|
@ -225,14 +225,19 @@ def main():
|
|
|
|
|
state = dict(default='present', choices=['absent', 'present'])
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if module.params['provider_network_type'] in ['vlan' , 'flat']:
|
|
|
|
|
if not module.params['provider_physical_network']:
|
|
|
|
|
module.fail_json(msg = " for vlan and flat networks, variable provider_physical_network should be set.")
|
|
|
|
|
|
|
|
|
|
if module.params['provider_network_type'] in ['vlan', 'gre']:
|
|
|
|
|
if not module.params['provider_segmentation_id']:
|
|
|
|
|
module.fail_json(msg = " for vlan & gre networks, variable provider_segmentation_id should be set.")
|
|
|
|
|
|
|
|
|
|
quantum = _get_quantum_client(module, module.params)
|
|
|
|
|
|
|
|
|
|
_set_tenant_id(module)
|
|
|
|
|
|
|
|
|
|
if module.params['state'] == 'present':
|
|
|
|
|
network_id = _get_net_id(quantum, module)
|
|
|
|
|
if not network_id:
|
|
|
|
@ -240,6 +245,7 @@ def main():
|
|
|
|
|
module.exit_json(changed = True, result = "Created", id = network_id)
|
|
|
|
|
else:
|
|
|
|
|
module.exit_json(changed = False, result = "Success", id = network_id)
|
|
|
|
|
|
|
|
|
|
if module.params['state'] == 'absent':
|
|
|
|
|
network_id = _get_net_id(quantum, module)
|
|
|
|
|
if not network_id:
|
|
|
|
@ -248,9 +254,6 @@ def main():
|
|
|
|
|
_delete_network(module, network_id, quantum)
|
|
|
|
|
module.exit_json(changed = True, result = "Deleted")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# this is magic, see lib/ansible/module.params['common.py
|
|
|
|
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
|
|
|
|
main()
|
|
|
|
|