Skip to content

Commit

Permalink
Fix K3s Path, Alternative folder in HA (#233)
Browse files Browse the repository at this point in the history
* Readd #143 fix

Signed-off-by: Derek Nola <[email protected]>

* Add PR template

Signed-off-by: Derek Nola <[email protected]>
  • Loading branch information
dereknola authored Nov 9, 2023
1 parent f369e3a commit fd6f288
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Changes ####

#### Linked Issues ####
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def provision(vm, role, node_num)
# Required to use the private network configured above
extra_server_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
extra_agent_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
k3s_server_location: "/data/k3s",
}
end
end
Expand Down
3 changes: 2 additions & 1 deletion roles/k3s/server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
mode: "u=rwx,g=rx,o="

- name: Pause to allow server startup
when: (groups['server'] | length) > 1
ansible.builtin.pause:
seconds: 10

Expand All @@ -48,7 +49,7 @@

- name: Change server to API endpoint instead of localhost
ansible.builtin.command: >-
k3s kubectl config set-cluster default
/usr/local/bin/k3s kubectl config set-cluster default
--server=https://{{ api_endpoint }}:{{ api_port }}
--kubeconfig ~{{ ansible_user }}/.kube/config
changed_when: true
Expand Down
19 changes: 13 additions & 6 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@
validate: 'visudo -cf %s'
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']

- name: Create symlink
ansible.builtin.file:
dest: /var/lib/rancher/k3s
src: "{{ k3s_server_location }}"
force: true
state: link
- name: Setup alternative K3s directory
when:
- k3s_server_location is defined
- k3s_server_location != "/var/lib/rancher/k3s"
block:
- name: Make rancher directory
ansible.builtin.file:
path: "/var/lib/rancher"
mode: 0755
state: directory
- name: Create symlink
ansible.builtin.file:
dest: /var/lib/rancher/k3s
src: "{{ k3s_server_location }}"
force: true
state: link

0 comments on commit fd6f288

Please sign in to comment.