scale.yaml 1.1 KB

1234567891011121314151617181920212223242526
  1. ---
  2. - shell: >
  3. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get {{object}}
  4. --template='{{ '{{.spec.replicas}}' }}' -n {{openshift_logging_namespace}}
  5. register: replica_count
  6. failed_when: replica_count.rc == 1 and 'exists' not in replica_count.stderr
  7. when: not ansible_check_mode
  8. - shell: >
  9. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig scale {{object}}
  10. --replicas={{desired}} -n {{openshift_logging_namespace}}
  11. register: scale_result
  12. failed_when: scale_result.rc == 1 and 'exists' not in scale_result.stderr
  13. when:
  14. - replica_count.stdout != desired
  15. - not ansible_check_mode
  16. - shell: >
  17. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig describe {{object}} -n {{openshift_logging_namespace}} | awk -v statusrx='Pods Status:' '$0 ~ statusrx {print $3}'
  18. register: replica_counts
  19. until: replica_counts.stdout.find("{{desired}}") != -1
  20. retries: 30
  21. delay: 10
  22. when:
  23. - replica_count.stdout != desired
  24. - not ansible_check_mode