fix(ansible): smoll tweaks for k3s install playbook

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2022-05-23 20:10:06 -04:00
1 parent 63e29a7257
commit db0e397172
1 file changed
+10 -12
+10 -12
View File
@@ -11,10 +11,10 @@
seconds: 5 seconds: 5
tasks: tasks:
- name: Check if cluster is installed - name: Check if cluster is installed
check_mode: false
ansible.builtin.stat: ansible.builtin.stat:
path: "/etc/rancher/k3s/config.yaml" path: "/etc/rancher/k3s/config.yaml"
register: k3s_check_installed register: k3s_check_installed
check_mode: false
- name: Set manifest facts - name: Set manifest facts
ansible.builtin.set_fact: ansible.builtin.set_fact:
@@ -31,7 +31,9 @@
delegate_to: localhost delegate_to: localhost
become: false become: false
run_once: true run_once: true
ansible.builtin.command: "git rev-parse --show-toplevel" check_mode: false
ansible.builtin.command: |-
git rev-parse --show-toplevel
register: repo_abs_path register: repo_abs_path
- name: Copy kubeconfig to provision folder - name: Copy kubeconfig to provision folder
@@ -54,23 +56,19 @@
replace: "https://{{ k3s_registration_address }}:6443" replace: "https://{{ k3s_registration_address }}:6443"
- name: Wait for k3s to finish installing the deployed manifests - name: Wait for k3s to finish installing the deployed manifests
ansible.builtin.pause: ansible.builtin.wait_for:
seconds: 15 timeout: 15
when: k3s_server_manifests_templates | length > 0
or k3s_server_manifests_dir | length > 0
- name: Remove deployed manifest templates - name: Remove deployed manifest templates
ansible.builtin.file: ansible.builtin.file:
path: "{{ k3s_server_manifests_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}" path: "{{ k3s_server_manifests_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
state: absent state: absent
loop: "{{ k3s_server_manifests_templates }}" loop: "{{ k3s_server_manifests_templates | default([]) }}"
when:
- k3s_server_manifests_templates
- k3s_server_manifests_templates | length > 0
- name: Remove deployed manifest urls - name: Remove deployed manifest urls
ansible.builtin.file: ansible.builtin.file:
path: "{{ k3s_server_manifests_dir }}/{{ item.filename }}" path: "{{ k3s_server_manifests_dir }}/{{ item.filename }}"
state: absent state: absent
loop: "{{ k3s_server_manifests_urls }}" loop: "{{ k3s_server_manifests_urls | default([]) }}"
when:
- k3s_server_manifests_urls
- k3s_server_manifests_urls | length > 0