Hi,
Is it possible to pass chdir directive to ad-hoc module?
I would like to do something like that;
ansible server -a 'cd /opt/; java -jar export.jar ’ [WRONG, don’t use it]
ansible server -a ‘java -jar export.jar’ -e chdir=/opt/’ [WRONG, don’t use it]
If I understand you to mean "ad hoc remote command" then yes. If you
mean to "any of the ansible modules" then no.
Things you can do:
ansible server -a 'chdir=/opt/ pwd'
ansible server -m shell 'cd /opt/; pwd'
Things you can't do:
ansible server -m git -a 'cd /opt/ ; dest=./in/opt'
Note: when no module is specified explicitly, the command module is
used. You can see the chdir parameter and other parameters that
command takes here: http://docs.ansible.com/command_module.html