mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Fix K3s Path, Alternative folder in HA (#233)
* Readd #143 fix Signed-off-by: Derek Nola <derek.nola@suse.com> * Add PR template Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
3
.github/workflows/pull_request_template.md
vendored
Normal file
3
.github/workflows/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#### Changes ####
|
||||||
|
|
||||||
|
#### Linked Issues ####
|
||||||
1
Vagrantfile
vendored
1
Vagrantfile
vendored
@@ -32,6 +32,7 @@ def provision(vm, role, node_num)
|
|||||||
# Required to use the private network configured above
|
# Required to use the private network configured above
|
||||||
extra_server_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
|
extra_server_args: "--node-external-ip #{node_ip} --flannel-iface eth1",
|
||||||
extra_agent_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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
mode: "u=rwx,g=rx,o="
|
mode: "u=rwx,g=rx,o="
|
||||||
|
|
||||||
- name: Pause to allow server startup
|
- name: Pause to allow server startup
|
||||||
|
when: (groups['server'] | length) > 1
|
||||||
ansible.builtin.pause:
|
ansible.builtin.pause:
|
||||||
seconds: 10
|
seconds: 10
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@
|
|||||||
|
|
||||||
- name: Change server to API endpoint instead of localhost
|
- name: Change server to API endpoint instead of localhost
|
||||||
ansible.builtin.command: >-
|
ansible.builtin.command: >-
|
||||||
k3s kubectl config set-cluster default
|
/usr/local/bin/k3s kubectl config set-cluster default
|
||||||
--server=https://{{ api_endpoint }}:{{ api_port }}
|
--server=https://{{ api_endpoint }}:{{ api_port }}
|
||||||
--kubeconfig ~{{ ansible_user }}/.kube/config
|
--kubeconfig ~{{ ansible_user }}/.kube/config
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|||||||
@@ -59,12 +59,19 @@
|
|||||||
validate: 'visudo -cf %s'
|
validate: 'visudo -cf %s'
|
||||||
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
||||||
|
|
||||||
- name: Create symlink
|
- name: Setup alternative K3s directory
|
||||||
ansible.builtin.file:
|
|
||||||
dest: /var/lib/rancher/k3s
|
|
||||||
src: "{{ k3s_server_location }}"
|
|
||||||
force: true
|
|
||||||
state: link
|
|
||||||
when:
|
when:
|
||||||
- k3s_server_location is defined
|
- k3s_server_location is defined
|
||||||
- k3s_server_location != "/var/lib/rancher/k3s"
|
- 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
|
||||||
|
|||||||
Reference in New Issue
Block a user