wild card is not working for adapter_names in win_dns_client

56 views
Skip to first unread message

Prakash PMS

unread,
Aug 12, 2020, 6:15:31 AM8/12/20
to Ansible Project
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 <ScriptBlock>, <No file>: 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

Dick Visser

unread,
Aug 12, 2020, 6:35:44 AM8/12/20
to ansible...@googlegroups.com
what ansible version are you running
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b186bd8-10de-42ea-97e1-24153555914ao%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Prakash PMS

unread,
Aug 12, 2020, 6:39:57 AM8/12/20
to Ansible Project

ansible 2.9.6 on ubuntu 20.04

On Wednesday, 12 August 2020 16:05:44 UTC+5:30, Dick Visser wrote:
what ansible version are you running

On Wed, 12 Aug 2020 at 12:15, Prakash PMS <praka...@gmail.com> wrote:
>
> 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 <ScriptBlock>, <No file>: 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
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

J Hawkesworth

unread,
Aug 12, 2020, 4:13:11 PM8/12/20
to Ansible Project
You proably need to fetch the adaptor name which you can do with Get-NetAdapter powershell command


then pass that to the module parameters.

Prakash PMS

unread,
Aug 13, 2020, 5:26:38 AM8/13/20
to Ansible Project

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.


- 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*'
Reply all
Reply to author
Forward
0 new messages