dynamic inventory / hostvars with shell vars not working w/ 1.6

93 views
Skip to first unread message

Lucas, Sascha

unread,
Aug 4, 2014, 9:57:28 AM8/4/14
to ansible...@googlegroups.com
Hi,

after upgrading from 1.4 to 1.6.10 I have following problem with dynamic inventory:

static inventory /tmp/inv:
[somegroup]
server15 ansible_ssh_host=X.X.X.X ansible_python_interpreter=/home/${SUDO_USER:-${USER}}/python-2.7/bin/python

Task with static inventory works as expected:
$ ansible -i /tmp/inv -m ping server15
server15 | success >> {
"changed": false,
"ping": "pong"
}

dynamic inventory script (output):
{
"_meta": {
"server15": {
"ansible_python_interpreter": "/home/${SUDO_USER:-${USER}}/python-2.7/bin/python",
"ansible_ssh_host": "X.X.X.X"
}
},
"somegroup": [
"server15"
]
}

Task with dynamic seems to mangle ${SUDO_USER:-${USER}} into ${SUDO_USER:-${USER#}:
$ ansible -i inventory/dyn_cmdb_inv.py -m ping server -vvv
< X.X.X.X > ESTABLISH CONNECTION FOR USER: someuser
< X.X.X.X > REMOTE_MODULE ping
< X.X.X.X > EXEC ['ssh', '-C', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/someuser/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', u' X.X.X.X, u"/bin/sh -c 'LC_CTYPE=C LANG=C /home/${SUDO_USER:-${USER#}/python-2.7/bin/python'"]
server15 | FAILED >> {
"failed": true,
"msg": "/bin/sh: -c: line 0: unexpected EOF while looking for matching `}'\n/bin/sh: -c: line 1: syntax error: unexpected end of file\n",
"parsed": false
}

Anything I can do better?

Thanks, Sascha.

Stellvertretender Vorsitzender des Aufsichtsrates: Detlef Hillebrand
Geschäftsführung: Michael Krüger
Sitz der Gesellschaft: Halle/Saale
Registergericht: Amtsgericht Stendal | Handelsregister-Nr. HRB 208414
UST-ID-Nr. DE 158253683

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Empfänger sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail oder des Inhalts dieser Mail sind nicht gestattet. Diese Kommunikation per E-Mail ist nicht gegen den Zugriff durch Dritte geschützt. Die GISA GmbH haftet ausdrücklich nicht für den Inhalt und die Vollständigkeit von E-Mails und den gegebenenfalls daraus entstehenden Schaden. Sollte trotz der bestehenden Viren-Schutzprogramme durch diese E-Mail ein Virus in Ihr System gelangen, so haftet die GISA GmbH - soweit gesetzlich zulässig - nicht für die hieraus entstehenden Schäden.

Michael DeHaan

unread,
Aug 4, 2014, 10:13:15 AM8/4/14
to ansible...@googlegroups.com
This seems like it's related to some of the anti-dangerous-variable usage logic in the system.

Please file a bug on this one and we can take a look.

1.7 will include numerous parser improvements and also massively increases parser test coverage, and will be out very soon.



--
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/383FAD2C9609F74D8F075EFF2B86B5795DAA1837%40SGIS111.gisa-halle.de.
For more options, visit https://groups.google.com/d/optout.

James Cammarata

unread,
Aug 5, 2014, 10:27:01 PM8/5/14
to ansible...@googlegroups.com
Hi Sascha, I've just looked into this and the issue has already been resolved in the devel branch. As Michael said, we'll be releasing 1.7 very soon, and this fix will be included in that release.

If you have any further questions regarding this, let us know.

Thanks!


Lucas, Sascha

unread,
Aug 6, 2014, 3:42:17 AM8/6/14
to ansible...@googlegroups.com
Hi,

From: James Cammarata
Date: Wed, 6. Aug 2014 04:27

> Hi Sascha, I've just looked into this and the issue has already been resolved in the devel branch. As Michael said, we'll be releasing 1.7 very soon, and this fix will be included in that release.

Thanks. I can confirm, that this works again with 1.7.

And sorry for messing up the github issue...
Reply all
Reply to author
Forward
0 new messages