Andrew Todd
unread,Aug 5, 2013, 6:04:54 PM8/5/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
I find myself in a fairly unfortunate situation where I'm trying to prove Ansible's versatility in adverse situations and coming up a bit short. Hopefully you can help.
I work with Solaris systems where I don't have root access and don't really have any kind of package manager available, so I have to improvise. I have a bootstrap playbook that connects to my remote Solaris box, downloads the Python 2.7 source code, and builds it in a prefix in my home directory using the shell module and gather_facts: false.
OK, now I want to set ansible_python_interpreter to point to the new Python install, so that the rest of my plays will work predictably. And I want to know what that prefix directory is throughout the rest of my plays as well. Of course, other people might run this Ansible play as well, so I can't hardcode my username. And I might want to use the same scripts on other systems, say, OS X.
What all this comes down to is that I need to dynamically set ansible_python_interpreter at some point in my site playbook and have it trickle down to all of the playbooks I'm including, the roles that they're using, etc. But when I set variables in site, they don't seem to be available in the sub-playbooks I include there.
Where's the best place to do this? Would I be better off making a separate "bootstrap" playbook and using a shell script to invoke the bootstrap playbook, then the real playbook sequentially? Would I be able to set these variables on the command-line then and have them work?
Thanks.