fix: use and reference credentialfile
This commit is contained in:
parent
b9f158c30f
commit
107417aaac
3 changed files with 20 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
6
templates/zot/sync-credentials.json.j2
Normal file
6
templates/zot/sync-credentials.json.j2
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"registry-1.docker.io": {
|
||||
"username": "{{ zot_dockerhub_username }}",
|
||||
"password": "{{ zot_dockerhub_password }}"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue