added support for login into hub via proxy

This commit is contained in:
Denis Pitzalis 2018-01-23 16:58:18 +01:00
parent dd0c6e0f8e
commit 641957761d
2 changed files with 33 additions and 0 deletions

View File

@ -17,3 +17,12 @@ docker_apt_repository: "deb https://download.docker.com/linux/{{ ansible_distrib
docker_yum_repo_url: https://download.docker.com/linux/centos/docker-{{ docker_edition }}.repo
docker_yum_repo_enable_edge: 0
docker_yum_repo_enable_test: 0
# configure corporate proxy
docker_http_proxy: ""
docker_no_proxy: "localhost,127.0.0.1,localaddress,.localdomain.com"
#login into docker hub
docker_hub_username: ""
docker_hub_password: ""
docker_hub_email: ""

View File

@ -38,3 +38,27 @@
repo: "{{ docker_apt_repository }}"
state: present
update_cache: yes
- name: Docker | Configure Proxy - Ubuntu systemd
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '16.04'
blockinfile:
path: /lib/systemd/system/docker.service
insertafter: '^\[Service\]$'
content: |
Environment="HTTP_PROXY={{ docker_http_proxy }}"
Environment="HTTPS_PROXY={{ docker_http_proxy }}"
Environment="NO_PROXY={{ docker_no_proxy }}"
- name: Docker | Reload configuration
systemd:
name: docker
enabled: yes
masked: no
daemon_reload: yes
state: restarted
- name: Docker | Log into DockerHub
docker_login:
username: "{{ docker_hub_username }}"
password: "{{ docker_hub_password }}"
email: "{{ docker_hub_email }}"