Non-Systemd installs: setup properly proxy variables for Docker
This commit is contained in:
parent
33ebf124c4
commit
9377bc1b7b
3 changed files with 39 additions and 0 deletions
|
@ -75,6 +75,15 @@
|
|||
notify: restart docker
|
||||
when: ansible_service_mgr == "systemd" and ansible_os_family != "CoreOS"
|
||||
|
||||
- name: Set docker proxy variables for non-systemd installs
|
||||
template:
|
||||
src: docker.j2
|
||||
dest: /etc/default/docker
|
||||
notify: restart docker
|
||||
when: ansible_service_mgr in ["sysvinit","upstart"] and
|
||||
ansible_os_family == "Debian" and
|
||||
(http_proxy is defined or https_proxy is defined or no_proxy is defined)
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: ensure docker service is started and enabled
|
||||
|
|
18
roles/docker/templates/docker.j2
Normal file
18
roles/docker/templates/docker.j2
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Deployed by Ansible
|
||||
{% if (ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "Debian") %}
|
||||
DOCKER_OPTS="{% if docker_options is defined %}{{ docker_options }}{% endif %}"
|
||||
{% else %}
|
||||
OPTIONS="{% if docker_options is defined %}{{ docker_options }}{% endif %}"
|
||||
{% endif %}
|
||||
|
||||
{% if (ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "Debian") %}
|
||||
{% if http_proxy %}
|
||||
export HTTP_PROXY="{{ http_proxy }}"
|
||||
{% endif %}
|
||||
{% if https_proxy %}
|
||||
export HTTPS_PROXY="{{ https_proxy }}"
|
||||
{% endif %}
|
||||
{% if no_proxy %}
|
||||
export NO_PROXY="{{ no_proxy }}"
|
||||
{% endif %}
|
||||
{% endif %}
|
|
@ -4,3 +4,15 @@ DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_opt
|
|||
{% else %}
|
||||
OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_options is defined %}{{ docker_options }}{% endif %}"
|
||||
{% endif %}
|
||||
|
||||
{% if (ansible_service_mgr in ["sysvinit","upstart"] and ansible_os_family == "Debian") %}
|
||||
{% if http_proxy %}
|
||||
export HTTP_PROXY="{{ http_proxy }}"
|
||||
{% endif %}
|
||||
{% if https_proxy %}
|
||||
export HTTPS_PROXY="{{ https_proxy }}"
|
||||
{% endif %}
|
||||
{% if no_proxy %}
|
||||
export NO_PROXY="{{ no_proxy }}"
|
||||
{% endif %}
|
||||
{% endif %}
|
Loading…
Reference in a new issue