Hi,
I have been testing ansible along with environment variables, since we utilize environment variables for various deployment reasons, I notice that on ansible will pick up any environment variables defined under .bashrc as thats the file sourced by /bin/login.
But under KSH, the profile file “.profile” is never read, and as such the ENV variable is not read, and as such, app/user environment is not visible within Ansible. Is there any suggestions on properly handing such cases?
Does ansible invoke its own “bash” shell, regardless of the ansible_user shell? For instance, if you run this against a KSH user:
ansible xxxxxx -i jet/projects/rbm/rbm_hosts -m shell -a “echo $SHELL”
{‘_host’: xxxxxx, ‘_task’: TASK: command, ‘_result’: {u’cmd’: u’echo /bin/bash’, u’end’: u’2016-05-18 18:20:37.051111’, ‘_ansible_no_log’: False, u’stdout’: u’/bin/bash’, u’changed’: True, u’start’: u’2016-05-18 18:20:37.047621’, u’delta’: u’0:00:00.003490’, u’stderr’: u’‘, u’rc’: 0, ‘invocation’: {‘module_name’: u’command’, u’module_args’: {u’creates’: None, u’executable’: None, u’chdir’: None, u’_raw_params’: u’echo /bin/bash’, u’removes’: None, u’warn’: True, u’_uses_shell’: True}}, ‘stdout_lines’: [u’/bin/bash’], u’warnings’: }}
dukerbdv99 | SUCCESS | rc=0 >>
/bin/bash
It returns /bin/bash, yet the user’s /etc/passwd clearly indicates it is KSH, and when I login, it is KSH.
Can anyone really clarify this for me?
Thanks in advance,
Ahmed