Checking ansible-playbook is using the right configuration

Hi,

I'm trying to work out why ansible doesn't seem to be respecting the settings in $PWD/ansible.cfg (specifically error_on_undefined_vars = True).

Is there some way of asking ansible-playbook to show me what it thinks its configuration is?

Thanks

N

No, there’s not a way to show this.

What version of Ansible are you using by the way?

May help us look further.

ansible-playbook --version

ansible-playbook 1.3 (devel 7c8aa669cf) last updated 2013/09/10 17:48:04 (GMT +100)

N

I can’t reproduce this, our “make tests” target uses local configurations for several of the tests it runs, so if this were an issue I’d expect to see tests fail. If you move your /etc/ansible/ansible.cfg to a different name, does it respect the local copy? Also, are you running ansible commands via sudo?

Not with sudo, no. And I’m running from a git checkout, so there is no /etc/ansible/ansible.cfg. Nor is there a ~/.ansible.cfg, and $ANSIBLE_CFG is not set. The odd thing is - IIRC - that I believe that variable merging is on. I didn’t think that was on by default. So my .cfg appears to be affecting the behaviour. An experiment suggests that dollar variables are checked but brace variables are. Since I am converting old playbooks to the new syntax and trying to pin down another oddity, I think that may be the cause of my confusion. For example: “ansible-playbook -l localhost -c local test.yml” outputs: Thanks, N ps One comment - documentation for ansible.cfg is a bit hard to track down. The main mention seems to be here - itself not somewhere I’d think to look first: but the information about the configuration parameters which exist seem to be spread around in the docs in places you can only find if you know where to look. To find the exact name for the error_on_undefined_vars parameter I needed to google for what I wanted and then reading a git pull request thread. Without checking the source I guess it’s possible that information is out of date. In addition, mis-spelling a parameter is easy and apparently generates no warnings, I’ve done that before. A valuable feature would be if Ansible told me when I if screwed one up.

Actually, after some more checks it seems there is more to this, but I’ll elaborate in a more appropriate thread, “When dollar variables are still necessary”

They aren’t necessary in your case, see the other thread.

They are still useful when making references inside other datastructures (arather rare thing) and we’ll have a syntax for this.