win_domain_computer module

63 views
Skip to first unread message

Ramakrishnan M

unread,
May 21, 2020, 5:13:41 PM5/21/20
to ansible...@googlegroups.com
Hi Guys,

Why would I get missing parameter error when I use win_domain_computer module when the parameter is set as optional.

  win_domain_computer:
      name: '{{ hostname }}'
  register: computer_account

Errors as...

FAILED! => {
    "changed": false,
    "msg": "Get-AnsibleParam: Missing required argument: dns_hostname"
}

Thanks

David Foley

unread,
May 21, 2020, 6:09:20 PM5/21/20
to Ansible Project
If your looking at doing work on Active Directory; you may need to switch over to "win_domain_membership"

Ramakrishnan M

unread,
May 21, 2020, 6:29:44 PM5/21/20
to ansible...@googlegroups.com
All I need is to get properties of a domain computer- Get-ADComputer. Ansible equivalent win_domain_computer.

Sent from my iPhone

> On May 21, 2020, at 17:09, David Foley <david...@mycit.ie> wrote:
>
> If your looking at doing work on Active Directory; you may need to switch over to "win_domain_membership"
>
> --
> 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/4264a2b3-c0ef-4c3d-96c3-ea621ee0bb3a%40googlegroups.com.

Jordan Borean

unread,
May 21, 2020, 8:39:52 PM5/21/20
to Ansible Project
According to the docs, dns_hostname is

Required when state=present.

So you need to have this set for the module to work.

Thanks

Jordan


Ramakrishnan M

unread,
May 21, 2020, 9:09:13 PM5/21/20
to ansible...@googlegroups.com
I tried that too, if I put State present, it’s asking for ou parameter is required. I want to retrieve it’s OU location. It just keep on asking one by one parameters as required. The documentation page for this module only says name is mandatory parameter, rest is optional.

Get-ADConputer will just work with identity as only parameter required.

Rama

Sent from my iPhone

On May 21, 2020, at 19:40, Jordan Borean <jbor...@gmail.com> wrote:


--
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.

Jordan Borean

unread,
May 21, 2020, 11:55:29 PM5/21/20
to Ansible Project
> The documentation page for this module only says name is mandatory parameter, rest is optional.

There is only 1 option that is always required 'name', but if you read the description you can see that there are multiple others that are required when 'state=present'.

> I want to retrieve it’s OU location

The module doesn't look like it will do what you want, it's designed to enforce a state which requires input. If you want to get the status/info of an existing resource you will have to develop your own win_domain_computer_info module or just use 'win_shell: Get-ADComputer' as you've already pointed out only requires the identity.
Reply all
Reply to author
Forward
0 new messages