From 8ac57201a70484eefc9715f15bcf6b4afef8fd31 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Mon, 30 Jul 2018 16:44:02 +0100 Subject: [PATCH] Prefix heketi kubectl calls with {{ bin_dir }} --- .../roles/provision/tasks/kubernetes.yml | 26 +++++++++---------- .../provision/tasks/kubernetes/label.yml | 6 ++--- .../heketi/roles/provision/tasks/main.yml | 6 ++--- .../heketi/roles/provision/tasks/setup.yml | 10 +++---- .../roles/provision/tasks/setup/boot.yml | 8 +++--- .../roles/provision/tasks/setup/heketi.yml | 4 +-- .../roles/provision/tasks/setup/storage.yml | 8 +++--- .../tasks/setup/tear-down-bootstrap.yml | 6 ++--- .../roles/provision/tasks/setup/topology.yml | 8 +++--- .../roles/provision/tasks/setup/volumes.yml | 12 ++++----- .../roles/provision/tasks/storageclass.yml | 6 ++--- .../heketi/roles/tear-down/tasks/main.yml | 26 +++++++++---------- 12 files changed, 63 insertions(+), 63 deletions(-) diff --git a/contrib/network-storage/heketi/roles/provision/tasks/kubernetes.yml b/contrib/network-storage/heketi/roles/provision/tasks/kubernetes.yml index e249fc1d1..6ab92713b 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/kubernetes.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/kubernetes.yml @@ -1,16 +1,16 @@ --- - register: "daemonset_state" - command: "kubectl get daemonset glusterfs -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get daemonset glusterfs -o=name --ignore-not-found=true" changed_when: false - name: "Deploy the GlusterFS DaemonSet" when: "daemonset_state.stdout == \"\"" - command: "kubectl create -f {{ kube_config_dir }}/glusterfs-daemonset.json" + command: "{{ bin_dir }}/kubectl create -f {{ kube_config_dir }}/glusterfs-daemonset.json" - register: "daemonset_state" - command: "kubectl get daemonset glusterfs --output=json --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get daemonset glusterfs --output=json --ignore-not-found=true" changed_when: false - name: "Wait for daemonset to become available." register: "daemonset_state" - command: "kubectl get daemonset glusterfs --output=json --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get daemonset glusterfs --output=json --ignore-not-found=true" changed_when: false vars: ready: "{{ daemonset_state.stdout|from_json|json_query(\"status.numberReady\") }}" @@ -26,29 +26,29 @@ include_tasks: "kubernetes/label.yml" - register: "service_account_state" - command: "kubectl get serviceaccount heketi-service-account -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get serviceaccount heketi-service-account -o=name --ignore-not-found=true" changed_when: false - name: "Deploy the Heketi service account" when: "service_account_state.stdout == \"\"" - command: "kubectl create -f {{ kube_config_dir }}/heketi-service-account.json" + command: "{{ bin_dir }}/kubectl create -f {{ kube_config_dir }}/heketi-service-account.json" - register: "service_account_state" - command: "kubectl get serviceaccount heketi-service-account -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get serviceaccount heketi-service-account -o=name --ignore-not-found=true" changed_when: false - assert: { that: "service_account_state.stdout != \"\"", message: "Heketi service account is not present." } - register: "clusterrolebinding_state" - command: "kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true" changed_when: false - name: "Deploy cluster role binding." when: "clusterrolebinding_state.stdout == \"\"" - command: "kubectl create clusterrolebinding heketi-gluster-admin --clusterrole=edit --serviceaccount=default:heketi-service-account" + command: "{{ bin_dir }}/kubectl create clusterrolebinding heketi-gluster-admin --clusterrole=edit --serviceaccount=default:heketi-service-account" - register: "clusterrolebinding_state" - command: "kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true" changed_when: false - assert: { that: "clusterrolebinding_state.stdout != \"\"", message: "Cluster role binding is not present." } - register: "secret_state" - command: "kubectl get secret heketi-config-secret -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get secret heketi-config-secret -o=name --ignore-not-found=true" changed_when: false - name: "Render Heketi secret configuration." become: true @@ -57,8 +57,8 @@ dest: "{{ kube_config_dir }}/heketi.json" - name: "Deploy Heketi config secret" when: "secret_state.stdout == \"\"" - command: "kubectl create secret generic heketi-config-secret --from-file={{ kube_config_dir }}/heketi.json" + command: "{{ bin_dir }}/kubectl create secret generic heketi-config-secret --from-file={{ kube_config_dir }}/heketi.json" - register: "secret_state" - command: "kubectl get secret heketi-config-secret -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get secret heketi-config-secret -o=name --ignore-not-found=true" changed_when: false - assert: { that: "secret_state.stdout != \"\"", message: "Heketi config secret is not present." } diff --git a/contrib/network-storage/heketi/roles/provision/tasks/kubernetes/label.yml b/contrib/network-storage/heketi/roles/provision/tasks/kubernetes/label.yml index 7ff9ee4ae..61729a5e2 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/kubernetes/label.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/kubernetes/label.yml @@ -1,11 +1,11 @@ --- - register: "label_present" - command: "kubectl get node --selector=storagenode=glusterfs,kubernetes.io/hostname={{ node }} --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get node --selector=storagenode=glusterfs,kubernetes.io/hostname={{ node }} --ignore-not-found=true" changed_when: false - name: "Assign storage label" when: "label_present.stdout_lines|length == 0" - command: "kubectl label node {{ node }} storagenode=glusterfs" + command: "{{ bin_dir }}/kubectl label node {{ node }} storagenode=glusterfs" - register: "label_present" - command: "kubectl get node --selector=storagenode=glusterfs,kubernetes.io/hostname={{ node }} --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get node --selector=storagenode=glusterfs,kubernetes.io/hostname={{ node }} --ignore-not-found=true" changed_when: false - assert: { that: "label_present|length > 0", msg: "Node {{ node }} has not been assigned with label storagenode=glusterfs." } diff --git a/contrib/network-storage/heketi/roles/provision/tasks/main.yml b/contrib/network-storage/heketi/roles/provision/tasks/main.yml index f85306b47..c247929a7 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/main.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/main.yml @@ -12,7 +12,7 @@ - name: "Test heketi setup." register: "heketi_service_state" - command: "kubectl get service heketi -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get service heketi -o=name --ignore-not-found=true" changed_when: false - name: "Setup heketi." @@ -21,14 +21,14 @@ - name: "Test storage class." changed_when: false - command: "kubectl get storageclass gluster --ignore-not-found=true --output=json" + command: "{{ bin_dir }}/kubectl get storageclass gluster --ignore-not-found=true --output=json" register: "storageclass" - name: "Setup storage class." when: "storageclass.stdout == \"\"" include_tasks: "storageclass.yml" - name: "Test storage class." changed_when: false - command: "kubectl get storageclass gluster --ignore-not-found=true --output=json" + command: "{{ bin_dir }}/kubectl get storageclass gluster --ignore-not-found=true --output=json" register: "storageclass" - name: "Ensure storage class is up." assert: { that: "storageclass.stdout != \"\"" } diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup.yml index a2c532fa0..96462dd11 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup.yml @@ -3,7 +3,7 @@ - name: "Get state of heketi service, deployment and pods." register: "initial_heketi_state" changed_when: false - command: "kubectl get services,deployments,pods --selector=deploy-heketi --output=json" + command: "{{ bin_dir }}/kubectl get services,deployments,pods --selector=deploy-heketi --output=json" - name: "Bootstrap heketi." when: - "(initial_heketi_state.stdout|from_json|json_query(\"items[?kind=='Service']\"))|length == 0" @@ -14,7 +14,7 @@ # Prepare heketi topology - name: "Get heketi initial pod state." register: "initial_heketi_pod" - command: "kubectl get pods --selector=deploy-heketi=pod,glusterfs=heketi-pod,name=deploy-heketi --output=json" + command: "{{ bin_dir }}/kubectl get pods --selector=deploy-heketi=pod,glusterfs=heketi-pod,name=deploy-heketi --output=json" changed_when: false - name: "Ensure heketi bootstrap pod is up." assert: @@ -24,7 +24,7 @@ - name: "Test heketi topology." changed_when: false register: "heketi_topology" - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" - name: "Load heketi topology." when: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*]\")|flatten|length == 0" include_tasks: "setup/topology.yml" @@ -35,10 +35,10 @@ # Prepare heketi storage - name: "Test heketi storage." - command: "kubectl get secrets,endpoints,services,jobs --output=json" + command: "{{ bin_dir }}/kubectl get secrets,endpoints,services,jobs --output=json" changed_when: false register: "heketi_storage_state" -- command: "kubectl get secrets,endpoints,services,jobs --output=json" +- command: "{{ bin_dir }}/kubectl get secrets,endpoints,services,jobs --output=json" register: "job" - name: "Create heketi storage." include_tasks: "setup/storage.yml" diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/boot.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/boot.yml index 6aab82cca..806e91570 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/boot.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/boot.yml @@ -2,9 +2,9 @@ - name: "Get state of heketi service, deployment and pods." register: "initial_heketi_state" changed_when: false - command: "kubectl get services,deployments,pods --selector=deploy-heketi --output=json" + command: "{{ bin_dir }}/kubectl get services,deployments,pods --selector=deploy-heketi --output=json" - name: "Create Heketi initial service and deployment" - command: "kubectl create -f {{ kube_config_dir }}/heketi-bootstrap.json" + command: "{{ bin_dir }}/kubectl create -f {{ kube_config_dir }}/heketi-bootstrap.json" when: - "(initial_heketi_state.stdout|from_json|json_query(\"items[?kind=='Service']\"))|length == 0" - "(initial_heketi_state.stdout|from_json|json_query(\"items[?kind=='Deployment']\"))|length == 0" @@ -12,14 +12,14 @@ - name: "Get state of heketi service, deployment and pods." register: "initial_heketi_state" changed_when: false - command: "kubectl get services,deployments,pods --selector=deploy-heketi --output=json" + command: "{{ bin_dir }}/kubectl get services,deployments,pods --selector=deploy-heketi --output=json" - name: "Wait for heketi bootstrap to complete." changed_when: false register: "initial_heketi_state" vars: pods_query: "items[?kind=='Pod'].status.conditions|[0][?type=='Ready'].status|[0]" deployments_query: "items[?kind=='Deployment'].status.conditions|[0][?type=='Available'].status|[0]" - command: "kubectl get services,deployments,pods --selector=deploy-heketi --output=json" + command: "{{ bin_dir }}/kubectl get services,deployments,pods --selector=deploy-heketi --output=json" until: - "initial_heketi_state.stdout|from_json|json_query(pods_query) == 'True'" - "initial_heketi_state.stdout|from_json|json_query(deployments_query) == 'True'" diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/heketi.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/heketi.yml index cba5e57ed..c38b151ac 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/heketi.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/heketi.yml @@ -1,9 +1,9 @@ --- - name: "Create long term Heketi instance." - command: "kubectl create -f {{ kube_config_dir }}/heketi-deployment.json" + command: "{{ bin_dir }}/kubectl create -f {{ kube_config_dir }}/heketi-deployment.json" - name: "Get heketi deployment state." register: "heketi_deployment_state" - command: "kubectl get deployment heketi -o=name --ignore-not-found=true" + command: "{{ bin_dir }}/kubectl get deployment heketi -o=name --ignore-not-found=true" changed_when: false - name: "Ensure heketi is up and running." assert: { that: "heketi_deployment_state.stdout != \"\"", message: "Heketi deployment did not succeed." } diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml index 1c471db3b..7c49a2258 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/storage.yml @@ -1,10 +1,10 @@ --- - name: "Test heketi storage." - command: "kubectl get secrets,endpoints,services,jobs --output=json" + command: "{{ bin_dir }}/kubectl get secrets,endpoints,services,jobs --output=json" changed_when: false register: "heketi_storage_state" - name: "Create heketi storage." - command: "kubectl create -f {{ kube_config_dir }}/heketi-storage.json" + command: "{{ bin_dir }}/kubectl create -f {{ kube_config_dir }}/heketi-storage.json" vars: secret_query: "items[?metadata.name=='heketi-storage-secret' && kind=='Secret']" endpoints_query: "items[?metadata.name=='heketi-storage-endpoints' && kind=='Endpoints']" @@ -16,10 +16,10 @@ - "heketi_storage_state.stdout|from_json|json_query(service_query)|length == 0" - "heketi_storage_state.stdout|from_json|json_query(job_query)|length == 0" register: "heketi_storage_result" -- command: "kubectl get secrets,endpoints,services,jobs --output=json" +- command: "{{ bin_dir }}/kubectl get secrets,endpoints,services,jobs --output=json" register: "heketi_storage_state" - name: "Get state of heketi storage service, endpoint, secret and job." - command: "kubectl get secrets,endpoints,services,jobs --output=json" + command: "{{ bin_dir }}/kubectl get secrets,endpoints,services,jobs --output=json" changed_when: false register: "heketi_storage_state" vars: diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/tear-down-bootstrap.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/tear-down-bootstrap.yml index 0fa3a1947..0ffd6f469 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/tear-down-bootstrap.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/tear-down-bootstrap.yml @@ -1,13 +1,13 @@ --- - name: "Get existing Heketi deploy resources." - command: "kubectl get all --selector=\"deploy-heketi\" -o=json" + command: "{{ bin_dir }}/kubectl get all --selector=\"deploy-heketi\" -o=json" register: "heketi_resources" changed_when: false - name: "Delete bootstrap Heketi." - command: "kubectl delete all,service,jobs,deployment,secret --selector=\"deploy-heketi\"" + command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"deploy-heketi\"" when: "heketi_resources.stdout|from_json|json_query('items[*]')|length > 0" - name: "Ensure there is nothing left over." - command: "kubectl get all,service,jobs,deployment,secret --selector=\"deploy-heketi\" -o=json" + command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"deploy-heketi\" -o=json" register: "heketi_result" until: "heketi_result.stdout|from_json|json_query('items[*]')|length == 0" retries: 60 diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/topology.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/topology.yml index 190a131c3..fd148d8d9 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/topology.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/topology.yml @@ -1,7 +1,7 @@ --- - name: "Get heketi topology." register: "heketi_topology" - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" - name: "Render heketi topology template." become: true vars: { nodes: "{{ groups['heketi-node'] }}" } @@ -9,13 +9,13 @@ src: "topology.json.j2" dest: "{{ kube_config_dir }}/topology.json" - name: "Copy topology configuration into container." - command: "kubectl cp {{ kube_config_dir }}/topology.json {{ initial_heketi_pod_name }}:/tmp/topology.json" + command: "{{ bin_dir }}/kubectl cp {{ kube_config_dir }}/topology.json {{ initial_heketi_pod_name }}:/tmp/topology.json" - name: "Load heketi topology." when: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*]\")|flatten|length == 0" - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology load --json=/tmp/topology.json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology load --json=/tmp/topology.json" - name: "Get heketi topology." register: "heketi_topology" - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli topology info --json" until: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*].devices[?state=='online'].id\")|flatten|length == groups['heketi-node']|length" retries: 60 delay: 5 diff --git a/contrib/network-storage/heketi/roles/provision/tasks/setup/volumes.yml b/contrib/network-storage/heketi/roles/provision/tasks/setup/volumes.yml index d8e7bf4b8..0d24a3a0b 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/setup/volumes.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/setup/volumes.yml @@ -1,11 +1,11 @@ --- - name: "Get heketi volume ids." - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume list --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume list --json" changed_when: false register: "heketi_volumes" - name: "Get heketi volumes." changed_when: false - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume info {{ volume_id }} --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume info {{ volume_id }} --json" with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}" loop_control: { loop_var: "volume_id" } register: "volumes_information" @@ -16,18 +16,18 @@ vars: { volume: "{{ volume_information.stdout|from_json }}" } when: "volume.name == 'heketidbstorage'" - name: "Provision database volume." - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli setup-openshift-heketi-storage" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli setup-openshift-heketi-storage" when: "heketi_database_volume_exists is undefined" - name: "Copy configuration from pod." become: true - command: "/usr/local/bin/kubectl cp {{ initial_heketi_pod_name }}:/heketi-storage.json {{ kube_config_dir }}/heketi-storage.json" + command: "{{ bin_dir }}/kubectl cp {{ initial_heketi_pod_name }}:/heketi-storage.json {{ kube_config_dir }}/heketi-storage.json" - name: "Get heketi volume ids." - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume list --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume list --json" changed_when: false register: "heketi_volumes" - name: "Get heketi volumes." changed_when: false - command: "kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume info {{ volume_id }} --json" + command: "{{ bin_dir }}/kubectl exec {{ initial_heketi_pod_name }} -- heketi-cli volume info {{ volume_id }} --json" with_items: "{{ heketi_volumes.stdout|from_json|json_query(\"volumes[*]\") }}" loop_control: { loop_var: "volume_id" } register: "volumes_information" diff --git a/contrib/network-storage/heketi/roles/provision/tasks/storageclass.yml b/contrib/network-storage/heketi/roles/provision/tasks/storageclass.yml index 761ec6533..393d76e64 100644 --- a/contrib/network-storage/heketi/roles/provision/tasks/storageclass.yml +++ b/contrib/network-storage/heketi/roles/provision/tasks/storageclass.yml @@ -1,10 +1,10 @@ --- - name: "Test storage class." - command: "kubectl get storageclass gluster --ignore-not-found=true --output=json" + command: "{{ bin_dir }}/kubectl get storageclass gluster --ignore-not-found=true --output=json" register: "storageclass" changed_when: false - name: "Test heketi service." - command: "kubectl get service heketi --ignore-not-found=true --output=json" + command: "{{ bin_dir }}/kubectl get service heketi --ignore-not-found=true --output=json" register: "heketi_service" changed_when: false - name: "Ensure heketi service is available." @@ -18,4 +18,4 @@ dest: "{{ kube_config_dir }}/storageclass.yml" - name: "Setup storage class." when: "storageclass.stdout == \"\"" - command: "kubectl create -f {{ kube_config_dir }}/storageclass.yml" + command: "{{ bin_dir }}/kubectl create -f {{ kube_config_dir }}/storageclass.yml" diff --git a/contrib/network-storage/heketi/roles/tear-down/tasks/main.yml b/contrib/network-storage/heketi/roles/tear-down/tasks/main.yml index 3943047ec..3c9659bae 100644 --- a/contrib/network-storage/heketi/roles/tear-down/tasks/main.yml +++ b/contrib/network-storage/heketi/roles/tear-down/tasks/main.yml @@ -1,52 +1,52 @@ --- - name: "Remove storage class." - command: "kubectl delete storageclass gluster" + command: "{{ bin_dir }}/kubectl delete storageclass gluster" ignore_errors: true - name: "Tear down heketi." - command: "kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\"" + command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\"" ignore_errors: true - name: "Tear down heketi." - command: "kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\"" + command: "{{ bin_dir }}/kubectl delete all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\"" ignore_errors: true - name: "Tear down bootstrap." include_tasks: "../provision/tasks/setup/tear-down-bootstrap.yml" - name: "Ensure there is nothing left over." - command: "kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\" -o=json" + command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-pod\" -o=json" register: "heketi_result" until: "heketi_result.stdout|from_json|json_query('items[*]')|length == 0" retries: 60 delay: 5 - name: "Ensure there is nothing left over." - command: "kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\" -o=json" + command: "{{ bin_dir }}/kubectl get all,service,jobs,deployment,secret --selector=\"glusterfs=heketi-deployment\" -o=json" register: "heketi_result" until: "heketi_result.stdout|from_json|json_query('items[*]')|length == 0" retries: 60 delay: 5 - name: "Tear down glusterfs." - command: "kubectl delete daemonset.extensions/glusterfs" + command: "{{ bin_dir }}/kubectl delete daemonset.extensions/glusterfs" ignore_errors: true - name: "Remove heketi storage service." - command: "kubectl delete service heketi-storage-endpoints" + command: "{{ bin_dir }}/kubectl delete service heketi-storage-endpoints" ignore_errors: true - name: "Remove heketi gluster role binding" - command: "kubectl delete clusterrolebinding heketi-gluster-admin" + command: "{{ bin_dir }}/kubectl delete clusterrolebinding heketi-gluster-admin" ignore_errors: true - name: "Remove heketi config secret" - command: "kubectl delete secret heketi-config-secret" + command: "{{ bin_dir }}/kubectl delete secret heketi-config-secret" ignore_errors: true - name: "Remove heketi db backup" - command: "kubectl delete secret heketi-db-backup" + command: "{{ bin_dir }}/kubectl delete secret heketi-db-backup" ignore_errors: true - name: "Remove heketi service account" - command: "kubectl delete serviceaccount heketi-service-account" + command: "{{ bin_dir }}/kubectl delete serviceaccount heketi-service-account" ignore_errors: true - name: "Get secrets" - command: "kubectl get secrets --output=\"json\"" + command: "{{ bin_dir }}/kubectl get secrets --output=\"json\"" register: "secrets" changed_when: false - name: "Remove heketi storage secret" vars: { storage_query: "items[?metadata.annotations.\"kubernetes.io/service-account.name\"=='heketi-service-account'].metadata.name|[0]" } - command: "kubectl delete secret {{ secrets.stdout|from_json|json_query(storage_query) }}" + command: "{{ bin_dir }}/kubectl delete secret {{ secrets.stdout|from_json|json_query(storage_query) }}" when: "storage_query is defined" ignore_errors: true - name: "Prepare cluster disks."