From 9785cab9739191b081746474bfc1d8034512fb17 Mon Sep 17 00:00:00 2001 From: Blair Rampling Date: Mon, 28 May 2018 03:07:47 -0700 Subject: [PATCH] adds name server group support to nios_zone (#37543) * adds name server group support to nios_zone * fixes style issues * adds support for restart_if_needed * adds type: bool to documentation for restart_if_needed * doc fix --- .../modules/net_tools/nios/nios_zone.py | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/net_tools/nios/nios_zone.py b/lib/ansible/modules/net_tools/nios/nios_zone.py index de5b6e51e7f..d4806bad59f 100644 --- a/lib/ansible/modules/net_tools/nios/nios_zone.py +++ b/lib/ansible/modules/net_tools/nios/nios_zone.py @@ -47,7 +47,6 @@ options: name: description: - The name of the grid primary server - required: true grid_secondaries: description: - Configures the grid secondary servers for this zone. @@ -55,7 +54,17 @@ options: name: description: - The name of the grid secondary server - required: true + ns_group: + version_added: "2.6" + description: + - Configures the name server group for this zone. Name server group is + mutually exclusive with grid primary and grid secondaries. + restart_if_needed: + version_added: "2.6" + description: + - If set to true, causes the NIOS DNS service to restart and load the + new zone configuration + type: bool extattrs: description: - Allows for the configuration of Extensible Attributes on the @@ -79,9 +88,27 @@ options: ''' EXAMPLES = ''' -- name: configure a zone on the system +- name: configure a zone on the system using grid primary and secondaries + nios_zone: + name: ansible.com + grid_primary: + - name: gridprimary.grid.com + grid_secondaries: + - name: gridsecondary1.grid.com + - name: gridsecondary2.grid.com + restart_if_needed: true + state: present + provider: + host: "{{ inventory_hostname_short }}" + username: admin + password: admin + connection: local + +- name: configure a zone on the system using a name server group nios_zone: name: ansible.com + ns_group: examplensg + restart_if_needed: true state: present provider: host: "{{ inventory_hostname_short }}" @@ -132,6 +159,8 @@ def main(): grid_primary=dict(type='list', elements='dict', options=grid_spec), grid_secondaries=dict(type='list', elements='dict', options=grid_spec), + ns_group=dict(), + restart_if_needed=dict(type='bool'), extattrs=dict(type='dict'), comment=dict() @@ -146,7 +175,11 @@ def main(): argument_spec.update(WapiModule.provider_spec) module = AnsibleModule(argument_spec=argument_spec, - supports_check_mode=True) + supports_check_mode=True, + mutually_exclusive=[ + ['ns_group', 'grid_primary'], + ['ns_group', 'grid_secondaries'] + ]) wapi = WapiModule(module) result = wapi.run('zone_auth', ib_spec)