From 95a54143637e8ce14a934e93c59b660515936746 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 9 Nov 2023 08:59:18 -0800 Subject: [PATCH 1/3] Readd #143 fix Signed-off-by: Derek Nola --- Vagrantfile | 1 + roles/k3s/server/tasks/main.yml | 3 ++- roles/prereq/tasks/main.yml | 22 +++++++++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 9c3c96f0..dd608f01 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/roles/k3s/server/tasks/main.yml b/roles/k3s/server/tasks/main.yml index 63196c27..6bde0af1 100644 --- a/roles/k3s/server/tasks/main.yml +++ b/roles/k3s/server/tasks/main.yml @@ -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 @@ -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 diff --git a/roles/prereq/tasks/main.yml b/roles/prereq/tasks/main.yml index be707b05..de41b9b5 100644 --- a/roles/prereq/tasks/main.yml +++ b/roles/prereq/tasks/main.yml @@ -59,12 +59,20 @@ 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 - when: +- 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 + From cd883753163bb3f2f94181518023fb60c0652064 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 9 Nov 2023 09:00:49 -0800 Subject: [PATCH 2/3] Add PR template Signed-off-by: Derek Nola --- .github/workflows/pull_request_template.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md new file mode 100644 index 00000000..a9a04071 --- /dev/null +++ b/.github/workflows/pull_request_template.md @@ -0,0 +1,3 @@ +#### Changes #### + +#### Linked Issues #### \ No newline at end of file From 23a91bd1cb7a351a16a61fd6cc81f60ffd9cf75a Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 9 Nov 2023 09:10:47 -0800 Subject: [PATCH 3/3] lint Signed-off-by: Derek Nola --- roles/prereq/tasks/main.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/roles/prereq/tasks/main.yml b/roles/prereq/tasks/main.yml index de41b9b5..5db6c1cc 100644 --- a/roles/prereq/tasks/main.yml +++ b/roles/prereq/tasks/main.yml @@ -60,19 +60,18 @@ when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat'] - name: Setup alternative K3s directory - when: + 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 - + - 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