# Ansible questions

**URL:** <https://forum.ansible.com/t/ansible-questions/12026>\
**Category:** Ansible Project\
**Created:** [October 25, 2012, 2:55pm UTC](https://forum.ansible.com/t/ansible-questions/12026 "2012-10-25T14:55:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [October 25, 2012, 2:55pm UTC](https://forum.ansible.com/t/ansible-questions/12026/1 "2012-10-25T14:55:21Z")

</div>

Hey folks. Ansible looks interesting, but I'm having a few issues with it. Apologies if these are covered in a document and I've missed them, I've been trying to read everything.

1. Is it possible to not specify hosts in playbooks, and include them on the ansible-playbook command line? Much of the logic I'm putting into playbooks can be carried out on any number of hosts, both old and new. I don't want to specify all hosts, because I don't necessarily want to run the play on each and every host each and every time it runs. But I don't necessarily want to edit 10-20 playbooks and include a new host if I'm given a new one to administer where the same logic would run, nor do I want to maintain a complicated grouping mechanism. It'd be nice if I could exclude hosts and do something like:

ansible-playbook \<playbook\> [hostspec]

and not fear that forgetting the hostspec would run the play everywhere by default.

2. Is there any way to specify that all command invocations should assume -K? Every system I administer requires a sudo password, and while -K isn't complicated to include, it must be added to every single invocation of every single command line. It'd be nice to have that as a flag somehow, and to default it to yes in my .ansible.cfg.

3. I ran into issues right away with the ping module. It works fine if ,my remote shell is set to Bash, or presumably to any number of Posix-like shells, but fails miserably if I use my default user shell of Fish. Here's what happens if I run the ping module by default with Fish as my shell:

\<thewordnerd.info\> ESTABLISH CONNECTION FOR USER: nolan on PORT 22 TO thewordnerd.info  
\<thewordnerd.info\> EXEC "$SHELL" -c 'mkdir -p $HOME/.ansible/tmp/ansible-1351176608.04-152697650487296 && chmod a+rx $HOME/.ansible/tmp/ansible-1351176608.04-152697650487296 && echo $HOME/.ansible/tmp/ansible-1351176608.04-152697650487296'  
\<thewordnerd.info\> REMOTE\_MODULE ping  
\<thewordnerd.info\> PUT /tmp/tmp81RNo\_ TO ^/ping  
thewordnerd.info | FAILED =\> failed to transfer file to ^/ping

If I change my remote shell to Bash, everything works. Other modules fail if I don't have Bash as my default shell. The fact that something as simple as the ping module failed with such a cryptic error was rather discouraging, and I'm wondering if the ping/fact collection modules require that bash or /bin/sh be their shell, that they should run that by default. I probably won't continue using Ansible if it won't let me have whatever default shell I want on my remote system.

Either way, thanks for a cool system.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [October 25, 2012, 3:49pm UTC](https://forum.ansible.com/t/ansible-questions/12026/2 "2012-10-25T15:49:59Z")

</div>

1. you can use variables for the host entry and pass them in the command line.

2. I use a simple alias (ansplay) that includes my own defaults, there are a bunch of ANSIBLE\_ environment variables and the ansible.cfg file that provide a place for you to set your defaults. The -K/sudo prompt doesn’t seem to be one of them but it should be easy to add/patch.

3. ping works fine with zsh and sh as shells (in my case), not sure what is going on here, try to execute with -v -v -v to get more details and someone will probably be able to help you.

---

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [October 25, 2012, 3:54pm UTC](https://forum.ansible.com/t/ansible-questions/12026/3 "2012-10-25T15:54:31Z")

</div>

Unfortunately, the execution I pasted was -vvv.

Thanks.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [October 25, 2012, 3:59pm UTC](https://forum.ansible.com/t/ansible-questions/12026/4 "2012-10-25T15:59:02Z")

</div>

Nolan,

sorry, missed that. Just ignore my comment then. Someone that knows the shell execution code better will probably get you an answer soon.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 25, 2012, 4:04pm UTC](https://forum.ansible.com/t/ansible-questions/12026/5 "2012-10-25T16:04:37Z")

</div>

I suspect the remote tmp variable is evaluating poorly for you.

[https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg](https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg)

When logged in with fish, if you "echo $HOME" what do you get? This  
is evaluated by the shell, so I'm guessing that's it.

We can make the remote\_tmp path configurable on a per-host/per-group  
basis if need be.

---

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [October 25, 2012, 4:43pm UTC](https://forum.ansible.com/t/ansible-questions/12026/6 "2012-10-25T16:43:07Z")

</div>

/home/nolan

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 25, 2012, 5:01pm UTC](https://forum.ansible.com/t/ansible-questions/12026/7 "2012-10-25T17:01:47Z")

</div>

hmm, ok, I'm at a loss about the "^" then.

Perhaps some other fish user that knows some Python wants to dive in?

---

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [October 25, 2012, 7:34pm UTC](https://forum.ansible.com/t/ansible-questions/12026/8 "2012-10-25T19:34:34Z")

</div>

I've switched to ZSH which works, and am trying to make my Fishisms work there so maybe I can use it more permanently.

If this is going to explode, though, would it make more sense to reroute some of these commands through a standard shell that is known to work by default? It is rather disconcerting to try a ping and have it fail. 🙂

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 25, 2012, 7:40pm UTC](https://forum.ansible.com/t/ansible-questions/12026/9 "2012-10-25T19:40:32Z")

</div>

On IRC we have suggested changing "$SHELL" to an explicit /bin/sh for  
our purposes. Seems reasonable.
