diff options
author | Michael DeHaan <michael@ansibleworks.com> | 2013-06-01 17:55:05 +0200 |
---|---|---|
committer | Michael DeHaan <michael@ansibleworks.com> | 2013-06-01 17:55:05 +0200 |
commit | 6a8e16e3242db942c2230efe7c4c15824434fbd7 (patch) | |
tree | 46d59c58eef7137562965be5a2cadfc36f0e4827 /library | |
parent | Standardize docs (diff) | |
download | ansible-6a8e16e3242db942c2230efe7c4c15824434fbd7.tar.xz ansible-6a8e16e3242db942c2230efe7c4c15824434fbd7.zip |
Standardize module doc
Diffstat (limited to 'library')
-rw-r--r-- | library/cloud/quantum_network | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/library/cloud/quantum_network b/library/cloud/quantum_network index e940049c69..44c2943b6a 100644 --- a/library/cloud/quantum_network +++ b/library/cloud/quantum_network @@ -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 @@ -209,30 +209,35 @@ def main(): module = AnsibleModule( argument_spec = dict( - login_username = dict(default='admin'), - login_password = dict(required=True), - login_tenant_name = dict(required='True'), - auth_url = dict(default='http://127.0.0.1:35357/v2.0/'), - region_name = dict(default=None), - name = dict(required=True), - tenant_name = dict(default=None), - provider_network_type = dict(default='local', choices=['local', 'vlan', 'flat', 'gre']), - provider_physical_network = dict(default=None), - provider_segmentation_id = dict(default=None), - router_external = dict(default='false', choices=BOOLEANS), - shared = dict(default='false', choices=BOOLEANS), - admin_state_up = dict(default='true', choices=BOOLEANS), - state = dict(default='present', choices=['absent', 'present']) + login_username = dict(default='admin'), + login_password = dict(required=True), + login_tenant_name = dict(required='True'), + auth_url = dict(default='http://127.0.0.1:35357/v2.0/'), + region_name = dict(default=None), + name = dict(required=True), + tenant_name = dict(default=None), + provider_network_type = dict(default='local', choices=['local', 'vlan', 'flat', 'gre']), + provider_physical_network = dict(default=None), + provider_segmentation_id = dict(default=None), + router_external = dict(default='false', choices=BOOLEANS), + shared = dict(default='false', choices=BOOLEANS), + admin_state_up = dict(default='true', choices=BOOLEANS), + 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() |