fix: add local registry cache for rebuilds
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
or (k3s_version != 'latest' and k3s_version not in (installed_k3s_version.stdout | default('')))
|
||||
}}
|
||||
|
||||
- name: Configure k3s registry mirrors
|
||||
import_role:
|
||||
name: k3s-registry-mirror
|
||||
|
||||
- name: Download k3s install script
|
||||
get_url:
|
||||
url: https://get.k3s.io
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
k3s_registry_mirror_enabled: true
|
||||
k3s_registry_mirror_host: 10.27.27.239
|
||||
k3s_registry_mirrors:
|
||||
docker.io:
|
||||
port: 5000
|
||||
ghcr.io:
|
||||
port: 5001
|
||||
quay.io:
|
||||
port: 5002
|
||||
registry.k8s.io:
|
||||
port: 5003
|
||||
oci.external-secrets.io:
|
||||
port: 5004
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Ensure k3s config directory exists
|
||||
file:
|
||||
path: /etc/rancher/k3s
|
||||
state: directory
|
||||
mode: "0755"
|
||||
when: k3s_registry_mirror_enabled | bool
|
||||
|
||||
- name: Configure k3s registry mirrors
|
||||
template:
|
||||
src: registries.yaml.j2
|
||||
dest: /etc/rancher/k3s/registries.yaml
|
||||
mode: "0644"
|
||||
when: k3s_registry_mirror_enabled | bool
|
||||
|
||||
- name: Remove k3s registry mirror config when disabled
|
||||
file:
|
||||
path: /etc/rancher/k3s/registries.yaml
|
||||
state: absent
|
||||
when: not (k3s_registry_mirror_enabled | bool)
|
||||
@@ -0,0 +1,6 @@
|
||||
mirrors:
|
||||
{% for registry, mirror in k3s_registry_mirrors.items() %}
|
||||
"{{ registry }}":
|
||||
endpoint:
|
||||
- "http://{{ k3s_registry_mirror_host }}:{{ mirror.port }}"
|
||||
{% endfor %}
|
||||
@@ -57,6 +57,10 @@
|
||||
- /var/lib/rancher/k3s
|
||||
when: k3s_install_needed
|
||||
|
||||
- name: Configure k3s registry mirrors
|
||||
import_role:
|
||||
name: k3s-registry-mirror
|
||||
|
||||
- name: Download k3s install script
|
||||
get_url:
|
||||
url: https://get.k3s.io
|
||||
|
||||
Reference in New Issue
Block a user