diff --git a/tasks/build/configure-k3s-cluster.yml b/tasks/build/configure-k3s-cluster.yml index ad08b20..f99c8f6 100644 --- a/tasks/build/configure-k3s-cluster.yml +++ b/tasks/build/configure-k3s-cluster.yml @@ -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 diff --git a/tasks/build/install-k3s.yml b/tasks/build/install-k3s.yml index e06bf96..80ea3e8 100644 --- a/tasks/build/install-k3s.yml +++ b/tasks/build/install-k3s.yml @@ -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 }}"