# wild card is not working for adapter\_names in win\_dns\_client

**URL:** <https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [August 12, 2020, 10:15am UTC](https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593 "2020-08-12T10:15:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prakash\_PMS](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@Prakash\_PMS](https://forum.ansible.com/u/Prakash_PMS)\
**Post date:** [August 12, 2020, 10:15am UTC](https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593/1 "2020-08-12T10:15:31Z")

</div>

Hi,

when wild card is used for adapter\_names in win\_dns\_client to set DNS in windows machines, it is not recognizing the interface.

tasks:

- name: Set DNS to Primary Domain Controller  
win\_dns\_client:  
adapter\_names: ‘tap\*’  
ipv4\_addresses: ‘{{ ad\_domain\_server }}’

Following is the error.

TASK [Set DNS to Primary Domain Controller] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at , : line 207  
fatal: [X.X.X.X]: FAILED! =\> {“changed”: false, “msg”: “Unhandled exception while executing module: Invalid network adapter name: tap\*”}

The documentation says wild card is supported and also given example for Ethernet\*. When windows instances are provisioned in openstack or kvm using redhat virtio driver, it creates interface with tapxxx format.

Regards  
Prakash

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [August 12, 2020, 10:35am UTC](https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593/2 "2020-08-12T10:35:16Z")

</div>

what ansible version are you running

---

<div class="post-metadata">

**Author:** ![Prakash\_PMS](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@Prakash\_PMS](https://forum.ansible.com/u/Prakash_PMS)\
**Post date:** [August 12, 2020, 10:39am UTC](https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593/3 "2020-08-12T10:39:57Z")

</div>

ansible 2.9.6 on ubuntu 20.04

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [August 12, 2020, 8:13pm UTC](https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593/4 "2020-08-12T20:13:10Z")

</div>

You proably need to fetch the adaptor name which you can do with Get-NetAdapter powershell command

[https://docs.microsoft.com/en-us/powershell/module/netadapter/get-netadapter?view=win10-ps](https://docs.microsoft.com/en-us/powershell/module/netadapter/get-netadapter?view=win10-ps)

then pass that to the module parameters.

---

<div class="post-metadata">

**Author:** ![Prakash\_PMS](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@Prakash\_PMS](https://forum.ansible.com/u/Prakash_PMS)\
**Post date:** [August 13, 2020, 9:26am UTC](https://forum.ansible.com/t/wild-card-is-not-working-for-adapter-names-in-win-dns-client/33593/5 "2020-08-13T09:26:37Z")

</div>

Thank you. Yes. we can fetch using powershell.

I was wondering why wild card support given in the documentation is not working. Now I am able to use ‘\*’ like given in the first example below and it works. But the second example given in the documentation doesn’t work.

[https://docs.ansible.com/ansible/latest/modules/win\_dns\_client\_module.html](https://docs.ansible.com/ansible/latest/modules/win_dns_client_module.html)

```auto
- name: Set multiple lookup addresses on all visible adapters (usually physical adapters that are in the Up state), with debug logging to a file
  win_dns_client:
    adapter_names: '*'

- name: Configure all adapters whose names begin with Ethernet to use DHCP-assigned DNS values
  win_dns_client:
    adapter_names: 'Ethernet*'

```
