diff --git a/lib/ansible/modules/storage/netapp/na_ontap_interface.py b/lib/ansible/modules/storage/netapp/na_ontap_interface.py index e25745e09b..0b1abea6b3 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_interface.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_interface.py @@ -76,9 +76,9 @@ options: - Specifies the firewall policy for the LIF. failover_policy: + choices: ['disabled', 'system-defined', 'local-only', 'sfo-partner-only', 'broadcast-domain-wide'] description: - Specifies the failover policy for the LIF. - - Possible values are 'disabled', 'system-defined', 'local-only', 'sfo-partner-only', and 'broadcast-domain-wide' subnet_name: description: @@ -111,6 +111,24 @@ options: - Protocol values of none, iscsi, fc-nvme or fcp can't be combined with any other data protocol(s). - address, netmask and firewall_policy parameters are not supported for 'fc-nvme' option. + dns_domain_name: + description: + - Specifies the unique, fully qualified domain name of the DNS zone of this LIF. + type: str + version_added: '2.9' + + listen_for_dns_query: + description: + - If True, this IP address will listen for DNS queries for the dnszone specified. + type: bool + version_added: '2.9' + + is_dns_update_enabled: + description: + - Specifies if DNS update is enabled for this LIF. Dynamic updates will be sent for this LIF if updates are enabled at Vserver level. + type: bool + version_added: '2.9' + ''' EXAMPLES = ''' @@ -129,6 +147,9 @@ EXAMPLES = ''' address: 10.10.10.10 netmask: 255.255.255.0 force_subnet_association: false + dns_domain_name: test.com + listen_for_dns_query: true + is_dns_update_enabled: true vserver: svm1 hostname: "{{ netapp_hostname }}" username: "{{ netapp_username }}" @@ -174,12 +195,17 @@ class NetAppOntapInterface(object): netmask=dict(required=False, type='str'), vserver=dict(required=True, type='str'), firewall_policy=dict(required=False, type='str', default=None), - failover_policy=dict(required=False, type='str', default=None), + failover_policy=dict(required=False, type='str', default=None, + choices=['disabled', 'system-defined', + 'local-only', 'sfo-partner-only', 'broadcast-domain-wide']), admin_status=dict(required=False, choices=['up', 'down']), subnet_name=dict(required=False, type='str'), is_auto_revert=dict(required=False, type='bool', default=None), protocols=dict(required=False, type='list'), - force_subnet_association=dict(required=False, type='bool', default=None) + force_subnet_association=dict(required=False, type='bool', default=None), + dns_domain_name=dict(required=False, type='str'), + listen_for_dns_query=dict(required=False, type='bool'), + is_dns_update_enabled=dict(required=False, type='bool') )) self.module = AnsibleModule( @@ -237,6 +263,14 @@ class NetAppOntapInterface(object): return_value['netmask'] = interface_attributes['netmask'] if interface_attributes.get_child_by_name('firewall-policy'): return_value['firewall_policy'] = interface_attributes['firewall-policy'] + if interface_attributes.get_child_by_name('dns-domain-name') != 'none': + return_value['dns_domain_name'] = interface_attributes['dns-domain-name'] + else: + return_value['dns_domain_name'] = None + if interface_attributes.get_child_by_name('listen-for-dns-query'): + return_value['listen_for_dns_query'] = self.na_helper.get_value_for_bool(True, interface_attributes['listen-for-dns-query']) + if interface_attributes.get_child_by_name('is-dns-update-enabled'): + return_value['is_dns_update_enabled'] = self.na_helper.get_value_for_bool(True, interface_attributes['is-dns-update-enabled']) return return_value @staticmethod @@ -260,6 +294,12 @@ class NetAppOntapInterface(object): options['administrative-status'] = parameters['admin_status'] if parameters.get('force_subnet_association') is not None: options['force-subnet-association'] = 'true' if parameters['force_subnet_association'] else 'false' + if parameters.get('dns_domain_name') is not None: + options['dns-domain-name'] = parameters['dns_domain_name'] + if parameters.get('listen_for_dns_query') is not None: + options['listen-for-dns-query'] = str(parameters['listen_for_dns_query']) + if parameters.get('is_dns_update_enabled') is not None: + options['is-dns-update-enabled'] = str(parameters['is_dns_update_enabled']) def set_protocol_option(self, required_keys): """ set protocols for create """ diff --git a/test/units/modules/storage/netapp/test_na_ontap_interface.py b/test/units/modules/storage/netapp/test_na_ontap_interface.py index acb761c2d3..18119e5a37 100644 --- a/test/units/modules/storage/netapp/test_na_ontap_interface.py +++ b/test/units/modules/storage/netapp/test_na_ontap_interface.py @@ -85,7 +85,10 @@ class MockONTAPConnection(object): 'address': data['address'], 'netmask': data['netmask'], 'role': data['role'], - 'protocols': data['protocols'] if data.get('protocols') else None + 'protocols': data['protocols'] if data.get('protocols') else None, + 'dns-domain-name': data['dns_domain_name'], + 'listen-for-dns_query': data['listen_for_dns_query'], + 'is-dns-update-enabled': data['is_dns_update_enabled'] } } } @@ -113,6 +116,9 @@ class TestMyModule(unittest.TestCase): 'home_port': 'e0c', 'address': '2.2.2.2', 'netmask': '1.1.1.1', + 'dns_domain_name': 'test.com', + 'listen_for_dns_query': True, + 'is_dns_update_enabled': True } def mock_args(self): @@ -248,6 +254,9 @@ class TestMyModule(unittest.TestCase): ''' Test successful modify interface_minutes ''' data = self.mock_args() data['home_port'] = 'new_port' + data['dns_domain_name'] = 'test2.com' + data['listen_for_dns_query'] = False + data['is_dns_update_enabled'] = False set_module_args(data) with pytest.raises(AnsibleExitJson) as exc: interface_obj = self.get_interface_mock_object('interface')