So far I've found out that if I have an inventory file (E.G inventory.yml)
within a playbook folder, and a file named web.yml in group_vars I can do a
win_ping without issues when the inventory file contains a group named
[web] and a server resides within this group - cool.
I expanded the inventory.yml and added additional groups [db] and added
servers to this new group.
If I run 'ansible all -i inventory.yml -m win_ping' - only the server
listed within the [web] group get's a successful connection/response. The
other servers listed within [db] fail with a message about failing to
connect to the host via ssh.
[WARNING]: ansible_winrm_cert_validation unsupported by pywinrm (is an
up-to-date version of pywinrm installed?)
webserver1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
db1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host db1
port 22: Connection timed out\r\n",
"unreachable": true
}
db2 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host db2
port 22: Connection timed out\r\n",
"unreachable": true
}
The web.yml file just contains connection information on how to connect to
the Windows boxes (winrm etc)
I then made a copy of web.yml and named it db.yml so now I have web.yml and
db.yml in the group_vars directory and ran the same ansible command again
to test the ping to all servers in the inventory file - this worked without
issues across all three hosts.
I want to know if there is a smarter/easier way to do this?
What is recommended practice - single inventory file for test, single
inventory file for production which you reference for your playbooks?
Inventory file must contains loads of groups so I'm guessing make a bunch
of copies of the files in group_vars is not the best way to approach
this....???
Thanks in advance.
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f6ef6efb-5f66-4438-9446-bf6d6e1538fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.