Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix K3s Path, Alternative folder in HA #233

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading