Skip to content

Commit

Permalink
Fix proxy settings for Docker daemon (#196)
Browse files Browse the repository at this point in the history
* fix: is_systemd toggle

the wrong fact was used to get distribution name

* fix: systemd proxy configuration

It is possible to use multiple Environment statements
A single Environment statement with multiple variables does not work
  • Loading branch information
escalate authored and angstwad committed Nov 16, 2017
1 parent 5fe2526 commit 473befb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
state: present
update_cache: yes
cache_valid_time: "{{ docker_apt_cache_valid_time }}"

- name: Add Docker repository key
apt_key:
id: "{{ apt_key_sig }}"
Expand Down Expand Up @@ -100,7 +100,7 @@
- name: Set systemd playbook var
set_fact:
is_systemd: true
when: ( ansible_distribution_release == "Ubuntu" and ansible_distribution_version|version_compare('15.04', '>=') or ansible_distribution == "Debian" )
when: ( ansible_distribution == "Ubuntu" and ansible_distribution_version|version_compare('15.04', '>=') or ansible_distribution == "Debian" )
tags: always

- name: Set docker_http_proxy_defined flag
Expand Down Expand Up @@ -277,7 +277,9 @@
copy:
content: |
[Service]
Environment="{% if docker_http_proxy_defined %}http_proxy={{ docker_http_proxy }}{% endif %} {% if docker_https_proxy_defined %}https_proxy={{ docker_https_proxy }}{% endif %} no_proxy={{ docker_no_proxy | default('') }}"
Environment="{% if docker_http_proxy_defined %}http_proxy={{ docker_http_proxy }}{% endif %}"
Environment="{% if docker_https_proxy_defined %}https_proxy={{ docker_https_proxy }}{% endif %}"
Environment="no_proxy={{ docker_no_proxy | default('') }}"
dest: /etc/systemd/system/docker.service.d/proxy.conf
owner: root
group: root
Expand Down

0 comments on commit 473befb

Please sign in to comment.