ad-hoc module chdir

111 views
Skip to first unread message

Serkan C.

unread,
Dec 2, 2014, 6:44:19 AM12/2/14
to ansible...@googlegroups.com
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]


Toshio Kuratomi

unread,
Dec 2, 2014, 7:57:44 PM12/2/14
to ansible...@googlegroups.com
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

-Toshio
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9fde79f4-86ef-4150-83a7-57e9442e809c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages