win_domain_computer module

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

If your looking at doing work on Active Directory; you may need to switch over to "win_domain_membership"

All I need is to get properties of a domain computer- Get-ADComputer. Ansible equivalent win_domain_computer.

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

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

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.