Debian Codegraph @

ansible_collections/infoblox/nios_modules/plugins/modules/nios_nsgroup_forwardstubserver.py

raw symbols SCIP
1 #!/usr/bin/python
2 # Copyright © 2020 Infoblox Inc
3 # -*- coding: utf-8 -*-
4 # Copyright (c) 2018-2019 Red Hat, Inc.
5 # Copyright (c) 2020 Infoblox, Inc.
6 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
7
8 from __future__ import absolute_import, division, print_function
9 __metaclass__ = type
10
11 DOCUMENTATION = '''
12 ---
13 module: nios_nsgroup_forwardstubserver
14 short_description: Configure Infoblox DNS Nameserver Forward/Stub Server 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 "Forward/Stub Server" form Infoblox NIOS servers.
21 This module manages NIOS C(nsgroup:forwardstubserver) 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 external_servers:
31 description:
32 - Specifies the list of name servers to be used
33 required: true
34 type: list
35 elements: dict
36 suboptions:
37 name:
38 description:
39 - Provide the name of the server
40 required: true
41 type: str
42 address:
43 description:
44 - Provide the IP address of the server
45 required: true
46 type: str
47 extattrs:
48 description:
49 - Allows for the configuration of Extensible Attributes on the
50 instance of the object. This argument accepts a set of key / value
51 pairs for configuration.
52 required: false
53 type: dict
54 comment:
55 description:
56 - Configures a text string comment to be associated with the instance
57 of this object. The provided text string will be configured on the
58 object instance.
59 required: false
60 type: str
61 state:
62 description:
63 - Configures the intended state of the instance of the object on
64 the NIOS server. When this value is set to C(present), the object
65 is configured on the device and when this value is set to C(absent)
66 the value is removed (if necessary) from the device.
67 choices: [present, absent]
68 default: present
69 type: str
70 '''
71
72 EXAMPLES = '''
73 - name: create infoblox nameserver forward/stub group
74 infoblox.nios_modules.nios_nsgroup_forwardstubserver:
75 name: my-forwardstub-group
76 comment: "this is a forward/stub nameserver group"
77 external_servers:
78 - name: first
79 address: 192.168.0.10
80 - name: second
81 address: 192.168.0.20
82 state: present
83 provider:
84 host: "{{ inventory_hostname_short }}"
85 username: admin
86 password: admin
87 connection: local
88 '''
89
90 RETURN = ''' # '''
91
92 from ansible.module_utils.basic import AnsibleModule
93 from ..module_utils.api import WapiModule
94 from ..module_utils.api import NIOS_NSGROUP_FORWARDSTUBSERVER
95 from ..module_utils.api import normalize_ib_spec
96
97
98 def main():
99 '''entrypoint for module execution.'''
100 argument_spec = dict(
101 provider=dict(required=True),
102 state=dict(default='present', choices=['present', 'absent']),
103 )
104
105 external_servers_spec = dict(
106 name=dict(required=True),
107 address=dict(required=True)
108 )
109
110 ib_spec = dict(
111 name=dict(required=True, ib_req=True),
112 external_servers=dict(type='list', elements='dict', required=True, options=external_servers_spec),
113 extattrs=dict(type='dict'),
114 comment=dict(),
115 )
116
117 argument_spec.update(normalize_ib_spec(ib_spec))
118 argument_spec.update(WapiModule.provider_spec)
119
120 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
121
122 wapi = WapiModule(module)
123 result = wapi.run(NIOS_NSGROUP_FORWARDSTUBSERVER, ib_spec)
124
125 module.exit_json(**result)
126
127
128 if __name__ == '__main__':
129 main()