Http proxy and global environment settings

I’m trying to run pre-existing playbooks against a set of nodes that require an HTTP proxy to reach the internet but not to reach each other.

It looks like the existing environment support in Ansible requires you to set the environment attribute on plays and tasks. This is difficult in pre-existing playbooks that you just want to pull down and run (such as ceph-ansible).

It doesn’t look like there is a global way (ansible.cfg) to specify the base environment you want used for Ansible modules. Has any thought been given to allowing a base environment be set in ansible.cfg and if it exists, have it be the base parent for the inheritance of the environment: attribute?

You can use environment variables on the remote hosts for this as well. See https://github.com/ansible/ansible/issues/22885 for an explanation about how and where env vars are generally seen by ansible.

Thanks. I agree that setting the env vars in some file(s) on the remote systems would also work. However, in a case where you are using Ansible to deploy a multi-system software that needs to communicate among nodes using REST API (http), for its own comm but needs a proxy for internet access (e.g. apt install), setting the env vars in /etc/environment or a user such as ubuntu/root would likely break the application as it would use the proxy for its inter-system calls vs just the Ansible’s wgets and apt-installs.