From cadd44bea448a3269a3ea1f12ebab379dde624d4 Mon Sep 17 00:00:00 2001 From: Adam Leiner Date: Fri, 21 Jun 2024 16:24:26 -0400 Subject: [PATCH] fixing some linting --- roles/rke2/tasks/cluster_state.yml | 11 +++++------ roles/rke2/tasks/main.yml | 2 -- roles/rke2/tasks/pre_reqs.yml | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/roles/rke2/tasks/cluster_state.yml b/roles/rke2/tasks/cluster_state.yml index 4f860e3..130fe3d 100644 --- a/roles/rke2/tasks/cluster_state.yml +++ b/roles/rke2/tasks/cluster_state.yml @@ -1,6 +1,9 @@ --- - name: Check for existing cluster + when: + - rke2_running is defined + - rke2_running block: - name: Check for node-token (existing cluster) ansible.builtin.stat: @@ -18,7 +21,8 @@ ansible.builtin.set_fact: rke2_config_token: "{{ rke2_config_token_tmp.content | b64decode | regex_replace('\n', '') }}" when: - - rke2_config_token_tmp.stat.exists + - "rke2_config_token_tmp.content is defined" + - rke2_config_token_tmp.content | length != 0 - name: Set node-token fact on all hosts (existing cluster) ansible.builtin.set_fact: @@ -27,8 +31,6 @@ run_once: true loop: "{{ groups['all'] }}" when: "hostvars[item]['rke2_config_token'] is defined" - vars: - rke2_config_token: "{{ rke2_config_token | default('') }}" - name: Debug found token ansible.builtin.debug: @@ -52,9 +54,6 @@ - hostvars[item]['rke2_kubernetes_api_server_host'] == "" vars: rke2_kubernetes_api_server_host: "{{ existing_join_host | default('') }}" - when: - - rke2_running is defined - - rke2_running - name: No existing cluster found and api server not set ansible.builtin.set_fact: diff --git a/roles/rke2/tasks/main.yml b/roles/rke2/tasks/main.yml index ce04e3b..407dfb5 100644 --- a/roles/rke2/tasks/main.yml +++ b/roles/rke2/tasks/main.yml @@ -82,8 +82,6 @@ when: - inventory_hostname in groups['rke2_servers'][1:] or inventory_hostname in groups.get('rke2_agents', []) - when: - - "rke2_config_token is not defined" - name: Confirm configuration on cluster when: diff --git a/roles/rke2/tasks/pre_reqs.yml b/roles/rke2/tasks/pre_reqs.yml index 2a82ad9..93fd03e 100644 --- a/roles/rke2/tasks/pre_reqs.yml +++ b/roles/rke2/tasks/pre_reqs.yml @@ -38,4 +38,3 @@ allow perm=any all : dir=/run/k3s/ allow perm=any all : dir=/var/lib/kubelet/ notify: Restart fapolicyd -