windows dynamic inventory

Hello Guys,

I am working in an azure environment and after research I am in need of some help. I am unable to find anywhere how to setup and use correctly azure plugin for dynamic inventory. Is this possible? Has anyone done it? (I have used this inventory type with Ansible in aws with linux servers). From what I understand from the documentation and current setup:

1)The environment is using ansible to run playbooks on all windows env
2)They are using static hosting with group/host.yml file for credentials

My setup

`

plugin: azure_rm

include_vm_resource_groups:

  • sittst_APP_RG

auth_source: auto

`

And I can run a ping command and get a valid denied to show the command is working (finding the servers)

`

fatal: [sittst-BATW-0_51db]: UNREACHABLE! => {
“changed”: false,
“unreachable”: true
}

MSG:

Failed to connect to the host via ssh: ssh: connect to host 10.176.96.130 port 22: Connection timed out

fatal: [sittst-BATD-0_b136]: UNREACHABLE! => {
“changed”: false,
“unreachable”: true
}

`

My issue now is how do I get it to connect to the windows servers

`

telnet 10.176.96.130 5985
Trying 10.176.96.130…
Connected to 10.176.96.130.
Escape character is ‘^]’.

`

Does this mean that in my config I will have to have something like this

`


plugin: azure_rm

include_vm_resource_groups:
- sittst_APP_RG

auth_source: auto

conditional_groups:
  all_the_hosts: true
  sittst-servers: "'sittst' in name"

`

and the create a file in group_vars/sittst.yaml

`

Any help?

Based on your output Ansible is still trying to connect over SSH with port 22. Your group vars are not applying to the host so it’s just using the defaults (SSH port 22).

Thank you, so am I doing something wrong? Is there any documentation on this?

I haven’t worked with the Azure dynamic inventory so I could be wrong but my guess is that with the lines

conditional_groups:
  all_the_hosts: true
  sittst-servers: "'sittst' in name"

You are creating a group called sittst-server which contains your host. You then have a file ‘group_vars/sittst.yaml’ which will only apply to hosts in the ‘sittst’ group and not ‘sittst-server’. The ‘group: sittst-servers’ entry in your group_vars file does not assign a group name to the hosts but rather just sets the group var which is nothing special. Either chang ethe filename to sittst-server.yaml or change the group name in conditional_groups to sittst.