ansible 1.8 (devel 4c86bd3ca6) not reading group_vars?

297 views
Skip to first unread message

Bob Tanner

unread,
Oct 21, 2014, 3:56:09 PM10/21/14
to ansible...@googlegroups.com
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

$ 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

Michael Wozniak

unread,
Oct 22, 2014, 4:51:20 PM10/22/14
to ansible...@googlegroups.com
I think your group_vars files should not have .yml extensions

--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/adae951c-81ba-4e3f-842d-ca5608fbc140%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Serge van Ginderachter

unread,
Oct 22, 2014, 4:56:07 PM10/22/14
to ansible...@googlegroups.com
​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..

Serge van Ginderachter

unread,
Oct 22, 2014, 4:57:11 PM10/22/14
to ansible...@googlegroups.com

On 22 October 2014 22:51, Michael Wozniak <mwoz...@itbit.com> wrote:
I think your group_vars files should not have .yml extensions

​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" ]

Michael Wozniak

unread,
Oct 22, 2014, 4:59:05 PM10/22/14
to ansible...@googlegroups.com
ah, ok.  Thanks.

--
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 post to this group, send email to ansible...@googlegroups.com.

Joseph Tam

unread,
Apr 8, 2015, 8:55:01 AM4/8/15
to ansible...@googlegroups.com
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

Brian Coca

unread,
Apr 8, 2015, 9:04:12 AM4/8/15
to ansible...@googlegroups.com
i would find that really strange as they both call the same inventory
code that is responsible for reading them.


--
Brian Coca

Matt Martz

unread,
Apr 8, 2015, 9:21:42 AM4/8/15
to ansible...@googlegroups.com
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.

Just a thought.

--
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 post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net

J Hawkesworth

unread,
Apr 10, 2015, 9:13:31 AM4/10/15
to ansible...@googlegroups.com
Looking at some of my group_vars files, they have the yaml header i.e. they start with 

---

but the example given above doesn't - could that be the difference?

Jon

J Hawkesworth

unread,
Apr 10, 2015, 9:14:40 AM4/10/15
to ansible...@googlegroups.com
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
---
ansible_ssh_user: Administrator
ansible_ssh_pass: "Password"
ansible_ssh_port: 5986
ansible_connection: winrm

Hope that helps,

Jon

Brian Coca

unread,
Apr 10, 2015, 9:40:12 AM4/10/15
to ansible...@googlegroups.com
It is optional, the header --- and footer .... are needed when you
want to have more than one yaml document per file.


--
Brian Coca
Reply all
Reply to author
Forward
0 new messages