fix: use and reference credentialfile

This commit is contained in:
Simon Cornet 2026-05-08 13:23:07 +02:00
commit 107417aaac
3 changed files with 20 additions and 6 deletions

View file

@ -4,6 +4,17 @@
- name: "configure zot"
block:
# create sync credentials file
- name: "create sync credentials file"
ansible.builtin.template:
src: "zot/sync-credentials.json.j2"
dest: "/etc/zot/sync-credentials.json"
owner: "root"
group: "root"
mode: "0600"
notify: "restart zot"
when: "zot_dockerhub_username is defined and zot_dockerhub_password is defined"
# create config file
- name: "create config file"
ansible.builtin.template:

View file

@ -41,15 +41,12 @@
},
"sync": {
"enable": true,
{% if zot_dockerhub_username is defined and zot_dockerhub_password is defined %}
"credentialsFile": "/etc/zot/sync-credentials.json",
{% endif %}
"registries": [
{
"urls": ["https://registry-1.docker.io"],
{% if zot_dockerhub_username is defined and zot_dockerhub_password is defined %}
"credentials": {
"username": "{{ zot_dockerhub_username }}",
"password": "{{ zot_dockerhub_password }}"
},
{% endif %}
"onDemand": true,
"tlsVerify": true,
"maxRetries": 3,

View file

@ -0,0 +1,6 @@
{
"registry-1.docker.io": {
"username": "{{ zot_dockerhub_username }}",
"password": "{{ zot_dockerhub_password }}"
}
}