support proxies with docker on rhel
This commit is contained in:
parent
96c63cc0b6
commit
adceaf60e1
4 changed files with 34 additions and 0 deletions
|
@ -123,3 +123,8 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address')
|
||||||
# server master2 10.99.0.27:443
|
# server master2 10.99.0.27:443
|
||||||
# balance roundrobin
|
# balance roundrobin
|
||||||
# apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
|
# 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: ""
|
||||||
|
|
|
@ -53,6 +53,11 @@
|
||||||
with_items: "{{ docker_package_info.pkgs }}"
|
with_items: "{{ docker_package_info.pkgs }}"
|
||||||
when: docker_package_info.pkgs|length > 0
|
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
|
- meta: flush_handlers
|
||||||
|
|
||||||
- name: ensure docker service is started and enabled
|
- name: ensure docker service is started and enabled
|
||||||
|
|
21
roles/docker/tasks/rhel-proxies.yml
Normal file
21
roles/docker/tasks/rhel-proxies.yml
Normal 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
|
3
roles/docker/templates/http-proxy.conf.j2
Normal file
3
roles/docker/templates/http-proxy.conf.j2
Normal 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 %}
|
Loading…
Reference in a new issue