Skip to content

Commit

Permalink
POC: Supporting k3s-ansible with external database
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Klijn <[email protected]>
  • Loading branch information
peterklijn committed Jun 20, 2024
1 parent 91ee70e commit ef17880
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
when: inventory_hostname == groups[server_group][0]
block:
- name: Copy K3s service file [Single]
when: groups[server_group] | length == 1
when: groups[server_group] | length == 1 or use_external_database | default(false) | bool
ansible.builtin.template:
src: "k3s-single.service.j2"
dest: "{{ systemd_dir }}/k3s.service"
Expand Down Expand Up @@ -148,14 +148,27 @@
- inventory_hostname != groups[server_group][0]
block:
- name: Copy K3s service file [HA]
when: groups[server_group] | length > 1
when:
- groups[server_group] | length > 1
- use_external_database | default(false) | bool == false
ansible.builtin.template:
src: "k3s-ha.service.j2"
dest: "{{ systemd_dir }}/k3s.service"
owner: root
group: root
mode: "0644"

- name: Copy K3s service file [External DB]
when:
- groups[server_group] | length > 1
- use_external_database | default(false) | bool
ansible.builtin.template:
src: "k3s-single.service.j2"
dest: "{{ systemd_dir }}/k3s.service"
owner: root
group: root
mode: "0644"

- name: Enable and check K3s service
ansible.builtin.systemd:
name: k3s
Expand Down

0 comments on commit ef17880

Please sign in to comment.