Docs/style

reviewable/pr18780/r1
Michael DeHaan 12 years ago
parent c33ed6942b
commit d5ff40ecc3

@ -38,12 +38,12 @@ 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
required: true required: true
default: True default: 'yes'
auth_url: auth_url:
description: description:
- The keystone url for authentication - The keystone url for authentication
@ -74,12 +74,14 @@ options:
- desired admin state of the created router . - desired admin state of the created router .
required: false required: false
default: true default: true
examples:
- code: "quantum_router: state=present login_username=admin login_password=admin login_tenant_name=admin name=router1"
description: "Creates a router for tenant admin"
requirements: ["quantumclient", "keystoneclient"] requirements: ["quantumclient", "keystoneclient"]
''' '''
EXAMPLES = '''
# Creates a router for tenant admin
quantum_router: state=present login_username=admin login_password=admin login_tenant_name=admin name=router1"
'''
_os_keystone = None _os_keystone = None
_os_tenant_id = None _os_tenant_id = None
@ -175,26 +177,28 @@ def main():
name = dict(required=True), name = dict(required=True),
tenant_name = dict(default=None), tenant_name = dict(default=None),
state = dict(default='present', choices=['absent', 'present']), state = dict(default='present', choices=['absent', 'present']),
admin_state_up = dict(default='true', choices=BOOLEANS), admin_state_up = dict(type='bool', default=True),
), ),
) )
quantum = _get_quantum_client(module, module.params) quantum = _get_quantum_client(module, module.params)
_set_tenant_id(module) _set_tenant_id(module)
if module.params['state'] == 'present': if module.params['state'] == 'present':
router_id = _get_router_id(module, quantum) router_id = _get_router_id(module, quantum)
if not router_id: if not router_id:
router_id = _create_router(module, quantum) router_id = _create_router(module, quantum)
module.exit_json(changed = True, result = "Created" , id = router_id) module.exit_json(changed=True, result="Created", id=router_id)
else: else:
module.exit_json(changed = False, result = "success" , id = router_id) module.exit_json(changed=False, result="success" , id=router_id)
else: else:
router_id = _get_router_id(module, quantum) router_id = _get_router_id(module, quantum)
if not router_id: if not router_id:
module.exit_json(changed = False, result = "success") module.exit_json(changed=False, result="success")
else: else:
_delete_router(module, quantum, router_id) _delete_router(module, quantum, router_id)
module.exit_json(changed = True, result = "deleted") module.exit_json(changed=True, result="deleted")
# 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>>

Loading…
Cancel
Save