| 1 |
|
| 2 |
c |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
from __future__ import absolute_import, division, print_function |
| 9 |
__metaclass__ = type |
| 10 |
|
| 11 |
DOCUMENTATION = ''' |
| 12 |
--- |
| 13 |
module: nios_nsgroup_stubmember |
| 14 |
short_description: Configure Infoblox DNS Nameserver Stub Member Groups |
| 15 |
extends_documentation_fragment: infoblox.nios_modules.nios |
| 16 |
author: |
| 17 |
- Mauricio Teixeira (@badnetmask) |
| 18 |
version_added: "1.7.0" |
| 19 |
description: |
| 20 |
- Adds and/or removes nameserver groups of type "Stub Member" form Infoblox NIOS servers. |
| 21 |
This module manages NIOS C(nsgroup:stubmember) objects using the Infoblox. WAPI interface over REST. |
| 22 |
requirements: |
| 23 |
- infoblox_client |
| 24 |
options: |
| 25 |
name: |
| 26 |
description: |
| 27 |
- Specifies the name of the NIOS nameserver group to be managed. |
| 28 |
required: true |
| 29 |
type: str |
| 30 |
stub_members: |
| 31 |
description: |
| 32 |
- Specifies the list of members to be used |
| 33 |
required: true |
| 34 |
type: list |
| 35 |
elements: dict |
| 36 |
suboptions: |
| 37 |
name: |
| 38 |
description: |
| 39 |
- Provide the name of the member |
| 40 |
required: true |
| 41 |
type: str |
| 42 |
extattrs: |
| 43 |
description: |
| 44 |
- Allows for the configuration of Extensible Attributes on the |
| 45 |
instance of the object. This argument accepts a set of key / value |
| 46 |
pairs for configuration. |
| 47 |
required: false |
| 48 |
type: dict |
| 49 |
comment: |
| 50 |
description: |
| 51 |
- Configures a text string comment to be associated with the instance |
| 52 |
of this object. The provided text string will be configured on the |
| 53 |
object instance. |
| 54 |
required: false |
| 55 |
type: str |
| 56 |
state: |
| 57 |
description: |
| 58 |
- Configures the intended state of the instance of the object on |
| 59 |
the NIOS server. When this value is set to C(present), the object |
| 60 |
is configured on the device and when this value is set to C(absent) |
| 61 |
the value is removed (if necessary) from the device. |
| 62 |
choices: [present, absent] |
| 63 |
default: present |
| 64 |
type: str |
| 65 |
''' |
| 66 |
|
| 67 |
EXAMPLES = ''' |
| 68 |
- name: create infoblox nameserver stub member group |
| 69 |
infoblox.nios_modules.nios_nsgroup_stubmember: |
| 70 |
name: my-stubmember-group |
| 71 |
comment: "this is a stub member nameserver group" |
| 72 |
stub_members: |
| 73 |
- name: member.localdomain |
| 74 |
state: present |
| 75 |
provider: |
| 76 |
host: "{{ inventory_hostname_short }}" |
| 77 |
username: admin |
| 78 |
password: admin |
| 79 |
connection: local |
| 80 |
''' |
| 81 |
|
| 82 |
RETURN = ''' # ''' |
| 83 |
|
| 84 |
from ansible.module_utils.basic import AnsibleModule |
| 85 |
from ..module_utils.api import WapiModule |
| 86 |
from ..module_utils.api import NIOS_NSGROUP_STUBMEMBER |
| 87 |
from ..module_utils.api import normalize_ib_spec |
| 88 |
|
| 89 |
|
| 90 |
def main(): |
| 91 |
'''entrypoint for module execution.''' |
| 92 |
argument_spec = dict( |
| 93 |
provider=dict(required=True), |
| 94 |
state=dict(default='present', choices=['present', 'absent']), |
| 95 |
) |
| 96 |
|
| 97 |
stub_members_spec = dict( |
| 98 |
name=dict(required=True), |
| 99 |
) |
| 100 |
|
| 101 |
ib_spec = dict( |
| 102 |
name=dict(required=True, ib_req=True), |
| 103 |
stub_members=dict(type='list', elements='dict', required=True, options=stub_members_spec), |
| 104 |
extattrs=dict(type='dict'), |
| 105 |
comment=dict(), |
| 106 |
) |
| 107 |
|
| 108 |
argument_spec.update(normalize_ib_spec(ib_spec)) |
| 109 |
argument_spec.update(WapiModule.provider_spec) |
| 110 |
|
| 111 |
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) |
| 112 |
|
| 113 |
wapi = WapiModule(module) |
| 114 |
result = wapi.run(NIOS_NSGROUP_STUBMEMBER, ib_spec) |
| 115 |
|
| 116 |
module.exit_json(**result) |
| 117 |
|
| 118 |
|
| 119 |
if __name__ == '__main__': |
| 120 |
main() |