Use a variable for standardizing kubectl invocation (#8329)

* Add kubectl variable

* Replace kubectl usage by kubectl variable in roles

* Remove redundant --kubeconfig on kubectl usage

* Replace unecessary shell usage with command
This commit is contained in:
Max Gautier
2022-01-05 11:26:32 +01:00
committed by GitHub
parent 3eab1129b9
commit cb54eb40ce
25 changed files with 73 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
---
- name: Wait for apiserver
command: "{{ bin_dir }}/kubectl get nodes"
command: "{{ kubectl }} get nodes"
environment:
- KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
register: apiserver_is_ready
@@ -11,7 +11,7 @@
when: groups['broken_kube_control_plane']
- name: Delete broken kube_control_plane nodes from cluster
command: "{{ bin_dir }}/kubectl delete node {{ item }}"
command: "{{ kubectl }} delete node {{ item }}"
environment:
- KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
with_items: "{{ groups['broken_kube_control_plane'] }}"