Bob_Tanner
(Bob Tanner)
October 21, 2014, 7:56pm
1
Following the documentation at http://docs.ansible.com/intro_windows.html .
I setup an inventory file and group windows.
I setup a group_vars for for windows.
$ cat customer/windows-testing
[windows]
appserv.int.domain.com
$ cat group_vars/windows.yml
ansible_ssh_user: Administrator
ansible_ssh_pass: “Password”
ansible_ssh_port: 5986
ansible_connection: winrm
$ whoami
basictheprogram
$ ansible windows -i customers/windows-testing -m win_ping -vvvv
<appserv.int.domain.com > ESTABLISH CONNECTION FOR USER: basictheprogram on PORT 22 TO appserv.int.domain.com
appserv.int.domain.com | FAILED => FAILED: Authentication failed.
I don’t understand why ansible is attempting to ssh (port 22) as basictheprogram (me) installed of winrm to port 5986 as Administrator.
$ ansible --version
ansible 1.8 (devel 4c86bd3ca6) last updated 2014/10/21 12:09:14 (GMT -500)
lib/ansible/modules/core: (detached HEAD cb69744bce) last updated 2014/10/07 14:28:03 (GMT -500)
lib/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated 2014/10/07 14:28:06 (GMT -500)
v2/ansible/modules/core: (detached HEAD cb69744bce) last updated 2014/10/07 14:28:11 (GMT -500)
v2/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated 2014/10/07 14:28:15 (GMT -500)
configured module search path = None
I think your group_vars files should not have .yml extensions
Given those paths:
$ customer/windows-testing
$ group_vars/windows.yml
Your group vars (current dir) are one level above your inventory
(within customer dir)
So they are not found..
That is not a problem, could even be .yaml or .json
lib/ansible/constants.py:# check all of these extensions when looking for
yaml files for things like
lib/ansible/constants.py:YAML_FILENAME_EXTENSIONS = [ "", ".yml", ".yaml",
".json" ]
I just experienced the same issue. ansible doesn’t seem to read group_vars, but ansible-playbook does. so my group_vars values are not used.
was this ever solved?
thanks
i would find that really strange as they both call the same inventory
code that is responsible for reading them.
sivel
(sivel)
April 8, 2015, 1:20pm
8
I guess one difference could be location? group_vars can also live at the same level as the playbook, as opposed to alongside the inventory.
Without a playbook, I don’t think playbook level group_vars would be loaded.
Looking at some of my group_vars files, they have the yaml header i.e. they start with
Reading that again, it might not be too clear what I mean.
so instead of
$ cat group_vars/windows.yml
ansible_ssh_user: Administrator
ansible_ssh_pass: “Password”
ansible_ssh_port: 5986
ansible_connection: winrm
$ cat group_vars/windows.yml
It is optional, the header --- and footer .... are needed when you
want to have more than one yaml document per file.