From c87619d70bf8068665430349bd458df8d0df12a4 Mon Sep 17 00:00:00 2001
From: thweber <thomas.weber@wu.ac.at>
Date: Mon, 5 Sep 2022 16:53:31 +0200
Subject: [PATCH] fix ccm command and token slurping

---
 roles/rke2/tasks/config_ccm.yml  | 7 +++----
 roles/rke2/tasks/config_rke2.yml | 1 -
 roles/rke2/tasks/main.yml        | 1 -
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/roles/rke2/tasks/config_ccm.yml b/roles/rke2/tasks/config_ccm.yml
index 8f45d6d..c92bc4d 100644
--- a/roles/rke2/tasks/config_ccm.yml
+++ b/roles/rke2/tasks/config_ccm.yml
@@ -14,14 +14,13 @@
     src: cloud.conf.j2
     dest: /tmp/cloud.conf
 
-- name: apply secrets for CCM
+- name: create secrets for CCM
   ansible.builtin.shell:
-    executable: /var/lib/rancher/rke2/bin/kubectl
-    cmd: create secret generic --namespace kube-system cloud-config --from-file=cloud.conf=/tmp/cloud.conf \
+    cmd: /var/lib/rancher/rke2/bin/kubectl create secret generic --namespace kube-system cloud-config --from-file=cloud.conf=/tmp/cloud.conf
   environment:
     KUBECONFIG: /etc/rancher/rke2/rke2.yaml
 
-- name: remove /tmp/cloud.conf on remote
+- name: remove /tmp/cloud.conf on master
   ansible.builtin.file:
     path: /tmp/cloud.conf
     state: absent
\ No newline at end of file
diff --git a/roles/rke2/tasks/config_rke2.yml b/roles/rke2/tasks/config_rke2.yml
index 3deb552..29f858a 100644
--- a/roles/rke2/tasks/config_rke2.yml
+++ b/roles/rke2/tasks/config_rke2.yml
@@ -1,5 +1,4 @@
 - name: slurp token
-  when: ('master' in group_names)
   block:
   - name: Load token
     slurp:
diff --git a/roles/rke2/tasks/main.yml b/roles/rke2/tasks/main.yml
index 1abc6c3..aa24eca 100644
--- a/roles/rke2/tasks/main.yml
+++ b/roles/rke2/tasks/main.yml
@@ -31,7 +31,6 @@
 
 - name: Flush handlers
   meta: flush_handlers
-  when: state != 'absent'
 
 - name: configure Openstack Cloud Controller Manager
   include_tasks: config_ccm.yml
-- 
GitLab