support proxies with docker on rhel

pull/230/head
Spencer Smith 2016-05-10 15:49:27 -07:00
parent 96c63cc0b6
commit adceaf60e1
4 changed files with 34 additions and 0 deletions

View File

@ -123,3 +123,8 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address')
# server master2 10.99.0.27:443
# balance roundrobin
# apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
##Set these proxy values in order to update docker daemon to use proxies
#http_proxy: ""
#https_proxy: ""
#no_proxy: ""

View File

@ -53,6 +53,11 @@
with_items: "{{ docker_package_info.pkgs }}"
when: docker_package_info.pkgs|length > 0
- name: allow for proxies on RHEL systems
include: rhel-proxies.yml
when: ansible_distribution in ["CentOS","RedHat"] and
ansible_distribution_major_version >= 7
- meta: flush_handlers
- name: ensure docker service is started and enabled

View File

@ -0,0 +1,21 @@
---
- name: create docker service directory for RHEL family
file: path=/etc/systemd/system/docker.service.d state=directory
when: ansible_distribution in ["CentOS","RedHat"] and
ansible_distribution_major_version >= 7
- name: drop docker environment for RHEL family
template:
src: http-proxy.conf.j2
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
when: ansible_distribution in ["CentOS","RedHat"] and
ansible_distribution_major_version >= 7
register: rheldockerproxy
- name: reload systemctl daemons for RHEL family
shell: systemctl daemon-reload
when: rheldockerproxy.changed
- name: restart docker for RHEL family
service: name=docker state=restarted
when: rheldockerproxy.changed

View File

@ -0,0 +1,3 @@
[Service]
Environment={% if http_proxy %}"HTTP_PROXY={{ http_proxy }}"{% endif %} {% if https_proxy %}"HTTPS_PROXY={{ https_proxy }}"{% endif %} {% if no_proxy %}"NO_PROXY={{ no_proxy }}"{% endif %}