Skip to content

Commit

Permalink
Approve CSR specific steps are removed from tasks/main.yml as those a…
Browse files Browse the repository at this point in the history
…re now handled by bash script

Signed-off-by: Chandan Abhyankar <chandan.abhyankar@gmail.com>
  • Loading branch information
Chandan-Abhyankar committed Dec 7, 2023
1 parent 30c9675 commit 2a92a56
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions ansible/post/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Post Installation Tasks (Approving CSRs, Setting up Node Labels)
- name: Post Installation Tasks (Setting up Node Labels)
hosts: all
vars_files:
- ../vars/main.yml
Expand All @@ -11,42 +11,6 @@
- kubernetes
- openshift

- name: Get CSRs
shell: |
oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name'
register: csr_list

- name: Print Pending CSRs
debug:
msg: "Pending CSR List is : {{ csr_list.stdout }}"

# Run approve CSR command till CSR list is empty.
- name: Approve Worker CSRs
shell: |
for i in $(oc get csr | grep -i pending | awk '{ print $1 }')
do
oc adm certificate approve $i
done
oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name'
register: csr_list
until: csr_list.stdout == ""
retries: 5
delay: 40
when: worker_count|int > 0

- name: Wait for 10 seconds before checking Ready state for Intel worker node/s
pause:
seconds: 10

# Run approve command again and wait till we have all powervs worker/s with Ready status. 'xargs -r ' is used to ignore empty stdin.
- name: Check Ready state for Intel Worker Node
shell: "oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs -r oc adm certificate approve && oc get nodes -l kubernetes.io/arch=amd64 | grep -w worker | grep -w Ready | wc -l"
register: ready_count_result
until: ready_count_result.stdout.find(worker_count) != -1
retries: 50
delay: 30
when: worker_count|int > 0

- name: Get Nodes with amd64 architecture
shell: "oc get nodes -l kubernetes.io/arch=amd64 | awk '(NR>1) { print $1 }'"
register: node_names
Expand Down

0 comments on commit 2a92a56

Please sign in to comment.