Ansible questions

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.

  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.

Unfortunately, the execution I pasted was -vvv.

Thanks.

Nolan,

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

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

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.

/home/nolan

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

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

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. :slight_smile:

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