feat: add task to handle registry logins
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2022-01-28 11:31:12 +01:00
parent 0b106d51c7
commit 2793a02ba3
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 28 additions and 3 deletions

View File

@ -15,6 +15,17 @@ dockerengine_secure_registries: []
dockerengine_insecure_registries: [] dockerengine_insecure_registries: []
dockerengine_block_registries: [] dockerengine_block_registries: []
# @var dockerengine_registries:description: List of docker registries to auto login
# @var dockerengine_registries:example: >
# dockerengine_registries:
# - registry: myregistry.example.com (optional)
# username: docker
# password: secure
# reauthorize: False
# state: present
# @end
dockerengine_registries: []
# @var dockerengine_http_proxy: $ "_unset_" # @var dockerengine_http_proxy: $ "_unset_"
# @var dockerengine_https_proxy: $ "_unset" # @var dockerengine_https_proxy: $ "_unset"
# @var dockerengine_no_proxy: $ "_unset_" # @var dockerengine_no_proxy: $ "_unset_"

View File

@ -15,9 +15,12 @@
group: root group: root
mode: 0644 mode: 0644
loop: loop:
- { src: 'etc/sysconfig/docker.j2', dest: '/etc/sysconfig/{{ dockerengine_service }}' } - src: "etc/sysconfig/docker.j2"
- { src: 'etc/sysconfig/docker-storage-setup.j2', dest: '/etc/sysconfig/{{ dockerengine_service }}-storage-setup' } dest: "/etc/sysconfig/{{ dockerengine_service }}"
- { src: 'etc/containers/registries.conf.j2', dest: '/etc/containers/registries.conf' } - src: "etc/sysconfig/docker-storage-setup.j2"
dest: "/etc/sysconfig/{{ dockerengine_service }}-storage-setup"
- src: "etc/containers/registries.conf.j2"
dest: "/etc/containers/registries.conf"
loop_control: loop_control:
label: "{{ item.dest }}" label: "{{ item.dest }}"
notify: __docker_restart notify: __docker_restart
@ -57,6 +60,17 @@
enabled: True enabled: True
state: started state: started
- name: Handle registry logins
docker_login:
registry: "{{ item.url | default(omit) }}"
username: "{{ item.username }}"
password: "{{ item.password }}"
reauthorize: "{{ item.reauthorize | default(False) }}"
state: '{{ item.state | default("present") }}'
loop: "{{ dockerengine_registries }}"
loop_control:
label: "{{ item.url }}"
- name: Create docker networks - name: Create docker networks
docker_network: docker_network:
name: "{{ item.name }}" name: "{{ item.name }}"