mirror of
https://github.com/PyratLabs/ansible-role-k3s.git
synced 2024-11-26 12:27:28 +01:00
Merge pull request #28 from pedrohdz/control-node-restart-k3s
Restart k3s service unit on file change
This commit is contained in:
commit
f454334b42
@ -16,7 +16,7 @@
|
||||
- name: Ensure k3s service unit file is present
|
||||
template:
|
||||
src: k3s.service.j2
|
||||
dest: /etc/systemd/system/k3s.service
|
||||
dest: "{{ k3s_systemd_unit_directory }}/k3s.service"
|
||||
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"
|
||||
notify:
|
||||
- reload systemd
|
||||
|
@ -1,12 +1,21 @@
|
||||
---
|
||||
|
||||
- name: Ensure k3s is symlinked into the installation destination on the contol plane
|
||||
file:
|
||||
src: "{{ k3s_install_dir }}/k3s-{{ k3s_release_version }}"
|
||||
dest: "{{ k3s_install_dir }}/k3s"
|
||||
state: link
|
||||
when: (k3s_control_node and k3s_controller_count | length == 1)
|
||||
or (k3s_primary_control_node and k3s_controller_count | length > 1)
|
||||
notify:
|
||||
- restart k3s
|
||||
become: "{{ k3s_become_for_install_dir | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- name: Ensure systemd unit file directory exists
|
||||
file:
|
||||
path: "{{ k3s_systemd_unit_directory }}"
|
||||
state: directory
|
||||
recurse: true
|
||||
when: (k3s_control_node and k3s_controller_count | length == 1)
|
||||
or (k3s_primary_control_node and k3s_controller_count | length > 1)
|
||||
|
||||
- name: Ensure k3s service unit file is present on control plane
|
||||
template:
|
||||
@ -16,6 +25,7 @@
|
||||
or (k3s_primary_control_node and k3s_controller_count | length > 1)
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart k3s
|
||||
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- meta: flush_handlers
|
||||
@ -34,7 +44,7 @@
|
||||
mode: 0700
|
||||
become: "{{ k3s_become_for_usr_local_bin | ternary(true, false, k3s_become_for_all) }}"
|
||||
|
||||
- name: Ensure k3s is symlinked into the installation destinations
|
||||
- name: Ensure k3s is symlinked into the installation destinations across all nodes
|
||||
file:
|
||||
src: "{{ k3s_install_dir }}/k3s-{{ k3s_release_version }}"
|
||||
dest: "{{ k3s_install_dir }}/{{ item }}"
|
||||
|
Loading…
Reference in New Issue
Block a user