[deploy-env] Add mirror to Docker configuration

There are some docker_container tasks which pull docker images.
This commit adds mirror configuration to daemon.json to prevent
encountering issues related to the pull rate limit.

+ update tls job according to the changes in openstack-helm

Depends-On: Ia58916e3dc5e0f50b476ece9bba31d8d656b3c44
Change-Id: Iac995500357336566cdbf9ddee0ae85b0b0347cd
This commit is contained in:
astebenkova 2024-04-30 14:07:35 +03:00 committed by Arina Stebenkova
parent 93aec7e807
commit 2f7377e17e
2 changed files with 26 additions and 12 deletions

View File

@ -5,6 +5,12 @@
"log-opts": { "log-opts": {
"max-size": "100m" "max-size": "100m"
}, },
{% if registry_mirror is defined %}
"registry-mirrors": ["{{ registry_mirror }}"],
{% endif %}
{% if insecure_registries is defined %}
"insecure-registries": ["{{ insecure_registries }}"],
{% endif %}
"storage-driver": "overlay2", "storage-driver": "overlay2",
"live-restore": true "live-restore": true
} }

View File

@ -49,21 +49,11 @@
state: present state: present
update_cache: true update_cache: true
- name: Configure Docker daemon
template:
src: files/daemon.json
dest: /etc/docker/daemon.json
- name: Add users to docker group - name: Add users to docker group
command: "adduser {{ item }} docker" command: "adduser {{ item }} docker"
loop: "{{ docker_users }}" loop: "{{ docker_users }}"
- name: Restart docker
service:
name: docker
daemon_reload: yes
state: restarted
- name: Reset ssh connection to apply user changes. - name: Reset ssh connection to apply user changes.
meta: reset_connection meta: reset_connection
@ -75,14 +65,21 @@
args: args:
executable: /bin/bash executable: /bin/bash
- name: Set mirror_fqdn fact - name: Set registry_mirror fact
when: when:
- registry_mirror is not defined - registry_mirror is not defined
- zuul_site_mirror_fqdn is defined - zuul_site_mirror_fqdn is defined
set_fact: set_fact:
registry_mirror: "http://{{ zuul_site_mirror_fqdn }}:8082" registry_mirror: "http://{{ zuul_site_mirror_fqdn }}:8082"
- name: Set regitstry namespaces - name: Set insecure_registries fact for Docker
when:
- insecure_registries is not defined
- zuul_site_mirror_fqdn is defined
set_fact:
insecure_registries: "{{ zuul_site_mirror_fqdn }}:8082"
- name: Set registry_namespaces fact
set_fact: set_fact:
registry_namespaces: registry_namespaces:
- namespace: "_default" - namespace: "_default"
@ -156,4 +153,15 @@
name: containerd name: containerd
daemon_reload: yes daemon_reload: yes
state: restarted state: restarted
- name: Configure Docker daemon
template:
src: files/daemon.json
dest: /etc/docker/daemon.json
- name: Restart docker
service:
name: docker
daemon_reload: yes
state: restarted
... ...