Setting the remote environment in a task
You can set the environment directly at the task level.
You can reuse environment settings by defining them as variables in your play and accessing them in a task as you would access any stored Ansible variable.
You can store environment settings for reuse in multiple playbooks by defining them in a group_vars file.
You can set the remote environment at the play level.
These examples show proxy settings, but you can provide any number of settings this way.