Hi there
Is there in ansible a way so set an linux environment variable for a ad-hoc mode and store it permanently in some place?
I tried host_vars, but that doesn’t worked.
I want to run this command:
ansible all -m shell -a "DEBIAN_FRONTEND=noninteractive apt-get upgrade”
without the need to explicit define DEBIAN_FRONTEND and make DEBIAN_FRONTEND=noninteractive the default for the shell module.
I don’t want to use a playbook, because normally I run ansible all -m shell -a "apt-get upgrade -s” to see what would be changed, and than
afterwards to run it without “-s”. I often forgot to set DEBIAN_FRONTEND=noninteractive in the ad-hoc command call.
I don’t want that this the default for the normal environment, when I ssh outside of ansible.
A possible workaround would be if I could recognize an ansible ssh connection from the inside of the host and than set the environment variable accordingly.
Any idea who to do it?
Or is there a proper ansible way of doing this?
thanks
yves