From 5a48c6d21a8c99601b9c6738b5e951fdbdf71e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Fernandes?= Date: Thu, 1 Oct 2026 22:18:48 +0000 Subject: [PATCH] add mylimbo.globals.k3s.registries_cache_mysetup --- playbooks/k3s/registries_cache_mysetup.yaml | 7 ++ .../{crictl_prune.yml => crictl_prune.yaml} | 0 roles/k3s/tasks/registries_cache_mysetup.yaml | 10 +++ .../k3s/templates/registries_cache_mysetup.j2 | 65 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 playbooks/k3s/registries_cache_mysetup.yaml rename roles/k3s/tasks/{crictl_prune.yml => crictl_prune.yaml} (100%) create mode 100644 roles/k3s/tasks/registries_cache_mysetup.yaml create mode 100644 roles/k3s/templates/registries_cache_mysetup.j2 diff --git a/playbooks/k3s/registries_cache_mysetup.yaml b/playbooks/k3s/registries_cache_mysetup.yaml new file mode 100644 index 0000000..134949a --- /dev/null +++ b/playbooks/k3s/registries_cache_mysetup.yaml @@ -0,0 +1,7 @@ +- name: setup k3s cache registries + hosts: '{{target|default("all")}}' + become: true + tasks: + - ansible.builtin.include_role: + name: mylimbo.globals.k3s + tasks_from: registries_cache_mysetup \ No newline at end of file diff --git a/roles/k3s/tasks/crictl_prune.yml b/roles/k3s/tasks/crictl_prune.yaml similarity index 100% rename from roles/k3s/tasks/crictl_prune.yml rename to roles/k3s/tasks/crictl_prune.yaml diff --git a/roles/k3s/tasks/registries_cache_mysetup.yaml b/roles/k3s/tasks/registries_cache_mysetup.yaml new file mode 100644 index 0000000..7fb308a --- /dev/null +++ b/roles/k3s/tasks/registries_cache_mysetup.yaml @@ -0,0 +1,10 @@ +# requires host/group vars +# oci_cache: +# address: https://xxxx.xxx.xx/v2 +# auth_username: xxxxx +# auth_password: Ixxxx + +- name: k3s - setup cache registries + ansible.builtin.template: + src: templates/registries_cache_mysetup + dest: /etc/rancher/k3s/registries.yaml \ No newline at end of file diff --git a/roles/k3s/templates/registries_cache_mysetup.j2 b/roles/k3s/templates/registries_cache_mysetup.j2 new file mode 100644 index 0000000..33ec29f --- /dev/null +++ b/roles/k3s/templates/registries_cache_mysetup.j2 @@ -0,0 +1,65 @@ +mirrors: + # --- Docker Hub (all aliases → docker-mirror) --- + docker.io: + endpoint: + - https://{{oci_cache.address}}/docker-mirror + registry-1.docker.io: + endpoint: + - https://{{oci_cache.address}}/docker-mirror + index.docker.io: + endpoint: + - https://{{oci_cache.address}}/docker-mirror + + # --- GHCR --- + ghcr.io: + endpoint: + - https://{{oci_cache.address}}/ghcr-mirror + + # --- Quay.io --- + quay.io: + endpoint: + - https://{{oci_cache.address}}/quay-mirror + + # --- Kubernetes official registry --- + registry.k8s.io: + endpoint: + - https://{{oci_cache.address}}/k8s-mirror + + # --- Google Container Registry + gcr.io: + endpoint: + - https://{{oci_cache.address}}/grc-mirror + + # --- AWS Public ECR --- + public.ecr.aws: + endpoint: + - https://{{oci_cache.address}}/aws-mirror + + # --- Microsoft Container Registry --- + mcr.microsoft.com: + endpoint: + - https://{{oci_cache.address}}/mcr-proxy + + # --- GitLab Container Registry --- + registry.gitlab.com: + endpoint: + - https://{{oci_cache.address}}/gitlab-mirror + + # --- Bitnami (namespace under Docker Hub) --- + docker.io/bitnami: + endpoint: + - https://{{oci_cache.address}}/bitnami-mirror + + # --- Red Hat registry --- + registry.redhat.io: + endpoint: + - https://{{oci_cache.address}}/readheat-mirror + + +configs: + oci.limbosolutions.com: + auth: + username: {{oci_cache.auth_username }} + password: {{oci_cache.auth_password }} + tls: + insecure_skip_verify: false \ No newline at end of file