mirror of
https://github.com/khuedoan/homelab.git
synced 2025-01-24 01:36:10 +07:00
Working k3s service and config
This commit is contained in:
parent
713631587c
commit
8a8d4d7ea2
6
metal/roles/k3s/handlers/main.yml
Normal file
6
metal/roles/k3s/handlers/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
- name: Restart k3s service
|
||||
systemd:
|
||||
name: k3s
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: restarted
|
@ -40,7 +40,6 @@
|
||||
dest: "{{ k3s_token_file }}"
|
||||
|
||||
- name: Copy k3s config files
|
||||
when: "'masters' in group_names"
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
@ -49,5 +48,6 @@
|
||||
dest: "{{ k3s_config_file }}"
|
||||
- src: k3s.service.j2
|
||||
dest: "{{ k3s_service_file }}"
|
||||
notify: Restart k3s service
|
||||
|
||||
# Get kubeconfig /etc/rancher/k3s/k3s.yaml
|
||||
|
@ -1 +1,6 @@
|
||||
{{ 'server' if 'masters' in group_names else 'agent' }}
|
||||
{% if inventory_hostname == groups['masters'][0] %}
|
||||
cluster-init: true
|
||||
{% else %}
|
||||
server: https://{{ hostvars[groups['masters'][0]].ansible_host }}:6443
|
||||
{% endif %}
|
||||
token-file: {{ k3s_token_file }}
|
||||
|
Loading…
Reference in New Issue
Block a user