Hi folks,
I am evaluating ansible 0.7.2 (using the Ubuntu PPA packages).
My first attempt at remote execution already failed.
User 'madduck' may run `apt-get update` on arnold.madduck.net, using
sudo without a password.
But if I run
ansible -v arnold.madduck.net -a "/usr/bin/apt-get update" --sudo
it fails:
arnold.madduck.net | FAILED >> {
"failed": true,
"msg": "\r\n\nSorry, user madduck is not allowed to execute '/bin/zsh -c /home/madduck/.ansible/tmp/ansible-1350291485.22-74945524909437/command' as root on arnold.madduck.net.\r\n",
"parsed": false
}
The reason is obvious: ansible calls sudo and passes it $SHELL,
calling a script (that is actually Python).
This raises two questions:
1. The docs explicitly say: "It [the command] will not be
processed through the shell…", and yes, either the Python
script, nor the command itself is processed through the shell,
and so the documentation is right. But why is the shell even
invoked? It seems like Paramiko or whatever executes the
command through the SSH session could just call the Python
script directly.
2. In combination with --sudo, the way this works means that
I have to give the remote user full rights with sudo
(user = (ALL) ALL). This kind of defeats the purpose, I think.
Since the raw module also invokes the shell (!?), there seems
to be no way to directly execute commands through ansible,
without a shell. In combination with --sudo, this means that it
is not possible to use ansible with a tightened sudo setup, or
is it?
Of course I can just specify 'sudo' as command manually or write
a connection plugin to do things differently, but I'd really rather
not have to customise core behaviour before even starting to use
your software.
Therefore, I would appreciate if you would consider my case. Could
it be that the invocation of the shell is a little too ubiquitous?
Or am I overlooking something obvious? Or is this actually designed
as desired and ansible does not fit my use case?
Thanks for your time,