tomereli.proxy
Ansible Role: Proxy
This is an Ansible role that sets up proxy server settings on Linux.
Requirements
No special requirements.
Role Variables
Here are the variables you can use, along with their default values (found in defaults/main.yml
):
http_proxy: "{{ ansible_env.http_proxy }}"
https_proxy: "{{ ansible_env.https_proxy }}"
ftp_proxy: "{{ ansible_env.ftp_proxy }}"
no_proxy: "{{ ansible_env.no_proxy }}"
By default, these proxy variables are taken from the host machine. If your proxy settings are different, you can change them. These settings are used to configure /etc/environment
and the package manager (apt/yum) proxies.
install_docker_service_proxy: true
install_docker_containers_proxy: true
The install_docker_service_proxy
variable determines if the docker service proxy (/etc/systemd/system/docker.service.d/proxy.conf
) should be installed. This allows the docker service to access the internet when behind a proxy, enabling it to download images.
The install_docker_containers_proxy
variable decides if a proxy should be set for docker containers (~/.docker/config.json
) for specific users. This lets containers access the internet through a proxy.
Dependencies
No dependencies required.
Example Playbooks
The following playbook configures the system and user proxy for root
and tomereli
users, using the proxy environment variables from the host machine:
- hosts: all
roles:
- role: tomereli.proxy
vars:
users:
- username: root
- username: tomereli
The next playbook sets up the system proxy using specified proxy settings:
- hosts: all
roles:
- role: tomereli.proxy
vars:
http_proxy: 'http://example-proxy-server.com:911/'
https_proxy: 'http://example-proxy-server.com:911/'
ftp_proxy: 'http://example-proxy-server.com:911/'
no_proxy: 'localhost'
License
MIT / BSD
Author Information
This role was created in 2020 by Tomer Arbel-Eliyahu
Set up proxy for Linux.
ansible-galaxy install tomereli.proxy