i want to use environments variables of the remote host .

72 views
Skip to first unread message

mondher khas

unread,
Apr 29, 2016, 8:36:51 AM4/29/16
to Ansible Project
Hi there, 

i want to use variables from the remote host i tried to save for example the variable JAVA_HOME existing in the remote host in a file , but the file is empty .
ansible can't find this variable .
is there any configuration , module ... to use to manipulate the environments variables of the remote host ?

---
- name: java home
  shell: chdir=/home  echo $JAVA_HOME > TEST.txt

the value of $JAVA_HOME is /usr/jdk1.8.0_65 when i execute "echo $JAVA_HOME" directly in the remote host but when i use ansible i can't catch any thing .

thank you in advance .

Anderson, Chad

unread,
Apr 29, 2016, 12:05:17 PM4/29/16
to ansible...@googlegroups.com
By default it is executing as /bin/sh so you'll want to add executable: /bin/bash if you are accessing environment variables set in your /etc/profile or ~/bash{_profile,rc}.

--
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/ca1911a1-6e04-4e17-83be-ad19e9e9718c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Chad Anderson
DevOps Engineer
DomainTools

Reply all
Reply to author
Forward
0 new messages