Hello,
I have a small play that runs in a remote server as a user X, during the become process, Ansible seems to invoke a remote command (command.py) that gets logged in the remote machine syslog. If the task for this play contains an environment variable, like PASSWORD for example, it will also be included in such log. Syslog is owned by root and not world-readable, but still I would like to be prevented. Is there a way to tell Ansible to include that environment variable inside the command.py?
Example play:
- hosts: dms
gather_facts: no
become: true
become_user: remote_user
tasks:
- name: Test command
shell: echo hello
environment:
PASSWORD: "supersecretpassword"
The logging observed on the syslog file (/var/log/messages):
Oct 12 15:13:39 remote-host sudo: myuser : TTY=pts/1 ; PWD=/home/myuser ; USER=remote_user ; COMMAND=/bin/bash -c echo BECOME-SUCCESS-gethoacihsravpsppeeepnhdcqkzgrpt; PASSWORD=supersecretpassword /usr/bin/python /tmp/ansible-tmp-1507821212.27-201142262398347/command.py
Oct 12 15:13:39 remote-host ansible-command: Invoked with warn=True executable=None _uses_shell=True _raw_params=echo hello removes=None creates=None chdir=None stdin=None
Thanks!