get_machinesets.yml 979 B

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. - name: List existing worker nodes
  3. k8s_facts:
  4. kubeconfig: "{{ kubeconfig_path }}"
  5. kind: Node
  6. label_selectors:
  7. - "node-role.kubernetes.io/worker"
  8. register: pre_scaleup_workers
  9. until:
  10. - pre_scaleup_workers.resources is defined
  11. - pre_scaleup_workers.resources | length > 0
  12. retries: 36
  13. delay: 5
  14. - name: Set fact pre_scaleup_workers_name
  15. set_fact:
  16. pre_scaleup_workers_name: "{{ pre_scaleup_workers.resources | map(attribute='metadata.name') | list }}"
  17. - name: Get existing worker machinesets
  18. k8s_facts:
  19. api_version: machine.openshift.io/v1beta1
  20. kubeconfig: "{{ kubeconfig_path }}"
  21. namespace: openshift-machine-api
  22. kind: MachineSet
  23. register: machineset
  24. until:
  25. - machineset.resources is defined
  26. - machineset.resources | length > 0
  27. retries: 36
  28. delay: 5
  29. - name: Set fact pre_scaleup_machineset_names
  30. set_fact:
  31. pre_scaleup_machineset_names: "{{ machineset.resources | map(attribute='metadata.name') | list }}"