Merge pull request #28 from pedrohdz/control-node-restart-k3s

Restart k3s service unit on file change
This commit is contained in:
Xan Manning 2020-06-06 15:05:43 +01:00 committed by GitHub
commit f454334b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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 }}"