mirror of
https://github.com/geerlingguy/ansible-role-docker.git
synced 2025-08-15 13:48:28 +02:00
Add proxy configuration.
This commit is contained in:
parent
416c0c9a06
commit
817285395e
@ -27,3 +27,8 @@ docker_yum_repo_enable_test: 0
|
|||||||
|
|
||||||
# A list of users who will be added to the docker group.
|
# A list of users who will be added to the docker group.
|
||||||
docker_users: []
|
docker_users: []
|
||||||
|
|
||||||
|
# proxy settings
|
||||||
|
http_proxy: ""
|
||||||
|
https_proxy: ""
|
||||||
|
no_proxy: ""
|
||||||
|
16
tasks/docker-service.yml
Normal file
16
tasks/docker-service.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure docker service dir exists.
|
||||||
|
file:
|
||||||
|
path: /etc/systemd/system/docker.service.d
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Add Docker configuration with proxy set.
|
||||||
|
template:
|
||||||
|
src: proxy.conf.j2
|
||||||
|
dest: /etc/systemd/system/docker.service.d/proxy.conf
|
||||||
|
register: proxy_template
|
||||||
|
|
||||||
|
- name: Reload systemd daemon if template is changed.
|
||||||
|
systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
when: proxy_template is changed
|
@ -15,6 +15,9 @@
|
|||||||
- import_tasks: docker-1809-shim.yml
|
- import_tasks: docker-1809-shim.yml
|
||||||
when: ansible_service_mgr == 'systemd'
|
when: ansible_service_mgr == 'systemd'
|
||||||
|
|
||||||
|
- import_tasks: docker-service.yml
|
||||||
|
when: ansible_service_mgr == 'systemd'
|
||||||
|
|
||||||
- name: Ensure Docker is started and enabled at boot.
|
- name: Ensure Docker is started and enabled at boot.
|
||||||
service:
|
service:
|
||||||
name: docker
|
name: docker
|
||||||
|
5
templates/proxy.conf.j2
Normal file
5
templates/proxy.conf.j2
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
[Service]
|
||||||
|
Environment='HTTP_PROXY={{ http_proxy }}'
|
||||||
|
Environment='HTTPS_PROXY={{ https_proxy }}'
|
||||||
|
Environment='NO_PROXY={{ no_proxy }}'
|
Loading…
Reference in New Issue
Block a user