Deploy a registries.yaml from registries_config on k3s servers and restart k3s on its change
This commit is contained in:
@@ -52,3 +52,14 @@ kubernetes:
|
|||||||
etcd-arg:
|
etcd-arg:
|
||||||
heartbeat-interval: 500
|
heartbeat-interval: 500
|
||||||
election-timeout: 5000
|
election-timeout: 5000
|
||||||
|
|
||||||
|
registries_config:
|
||||||
|
# Defines the names and endpoints of registries
|
||||||
|
# When embedded-registry is enabled, every registry needs to be defined here to allow this node to distribute those images.
|
||||||
|
#mirrors:
|
||||||
|
# Enable distribution for all registries
|
||||||
|
#"*": {}
|
||||||
|
|
||||||
|
# Defines authentication and extra settings for the registries
|
||||||
|
#config:
|
||||||
|
|
||||||
@@ -36,6 +36,13 @@
|
|||||||
mode: "744"
|
mode: "744"
|
||||||
# todo: update when file changed?
|
# todo: update when file changed?
|
||||||
|
|
||||||
|
- name: Deploy registries.yaml
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: k3s/server/registries.yaml.j2
|
||||||
|
dest: /etc/rancher/k3s/registries.yaml
|
||||||
|
register: registries_config
|
||||||
|
when: "type == 'server'"
|
||||||
|
|
||||||
- import_tasks: ./install/server/setup_network.yml
|
- import_tasks: ./install/server/setup_network.yml
|
||||||
when: "type == 'server'"
|
when: "type == 'server'"
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
service:
|
service:
|
||||||
name: k3s
|
name: k3s
|
||||||
enabled: true
|
enabled: true
|
||||||
state: "{{ 'restarted' if not command.changed and config.changed else 'started' }}"
|
state: "{{ 'restarted' if not command.changed and (config.changed or registries_config.changed) else 'started' }}"
|
||||||
|
|
||||||
- name: Waiting for K3s-server to accept connections
|
- name: Waiting for K3s-server to accept connections
|
||||||
ansible.builtin.wait_for:
|
ansible.builtin.wait_for:
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{{ kubernetes.registries_config | to_nice_yaml(indent=2) }}
|
||||||
Reference in New Issue
Block a user