Browse Source
Add header configuration in containerd hosts.toml (#12368 )
* Add header configuration in containerd hosts.toml
Signed-off-by: Alexander Gil <pando855@gmail.com>
* Disable log output on containerd mirrors settings if required
Signed-off-by: Alexander Gil <pando855@gmail.com>
---------
Signed-off-by: Alexander Gil <pando855@gmail.com>
pull/12388/head
pando85
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
12 additions and
1 deletions
inventory/sample/group_vars/all/containerd.yml
roles/container-engine/containerd/defaults/main.yml
roles/container-engine/containerd/tasks/main.yml
roles/container-engine/containerd/templates/hosts.toml.j2
@ -50,6 +50,8 @@
# - host: https://registry-1.docker.io
# capabilities: ["pull", "resolve"]
# skip_verify: false
# header:
# Authorization: "Basic XXX"
# containerd_max_container_log_line_size: 16384
@ -64,7 +64,8 @@ containerd_registries_mirrors:
skip_verify : false
# ca: ["/etc/certs/mirror.pem"]
# client: [["/etc/certs/client.pem", ""],["/etc/certs/client.cert", "/etc/certs/client.key"]]
# header:
# Authorization: "Basic XXX"
containerd_max_container_log_line_size : 16384
# If enabled it will allow non root users to use port numbers <1024
@ -73,6 +73,8 @@
notify : Restart containerd
- name : Containerd | Configure containerd registries
# mirror configuration can contain sensitive information on headers configuration
no_log : "{{ not (unsafe_show_logs | bool) }}"
block:
- name : Containerd | Create registry directories
file:
@ -10,4 +10,10 @@ server = "{{ item.server | default("https://" + item.prefix) }}"
{% if mirror.client is defined %}
client = [{% for pair in mirror.client %}["{{ pair[0] }}", "{{ pair[1] }}"]{% if not loop.last %},{% endif %}{% endfor %}]
{% endif %}
{% if mirror.header is defined %}
[host."{{ mirror.host }}".header]
{% for key, value in mirror.header.items() %}
{{ key }} = ["{{ ([ value ] | flatten ) | join('","') }}"]
{% endfor %}
{% endif %}
{% endfor %}