scaleup.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ---
  2. - name: Pre-scaleup checks
  3. hosts: localhost
  4. connection: local
  5. gather_facts: no
  6. tasks:
  7. - fail:
  8. msg: >
  9. Detected no new_workers in inventory. Please add hosts to the
  10. new_workers host group to add nodes.
  11. when: groups.new_workers | default([]) | length == 0
  12. - name: run the init
  13. import_playbook: ../init/main.yml
  14. vars:
  15. l_init_fact_hosts: "new_workers"
  16. l_openshift_version_set_hosts: "new_workers"
  17. l_install_base_packages: True
  18. l_repo_hosts: "new_workers"
  19. l_base_packages_hosts: "new_workers"
  20. - name: Get release image
  21. hosts: localhost
  22. connection: local
  23. gather_facts: no
  24. tasks:
  25. - name: Get release image
  26. oc_obj:
  27. kubeconfig: "{{ kubeconfig_path }}"
  28. state: present
  29. kind: clusterversion.config.openshift.io
  30. name: version
  31. register: clusterversion
  32. until:
  33. - clusterversion.results is defined
  34. - clusterversion.results.returncode is defined
  35. - clusterversion.results.returncode == 0
  36. - clusterversion.results.results is defined
  37. - clusterversion.results.results | length > 0
  38. - clusterversion.results.results[0].status is defined
  39. - clusterversion.results.results[0].status.desired is defined
  40. - clusterversion.results.results[0].status.desired.image is defined
  41. retries: 5
  42. delay: 5
  43. - name: install nodes
  44. hosts: new_workers
  45. tasks:
  46. - import_role:
  47. name: openshift_node40
  48. tasks_from: install.yml
  49. - name: Wait for bootstrap endpoint to show up
  50. uri:
  51. url: "{{ openshift_bootstrap_endpoint }}"
  52. validate_certs: false
  53. delay: 10
  54. retries: 60
  55. register: result
  56. until:
  57. - "'status' in result"
  58. - result.status == 200
  59. - import_role:
  60. name: openshift_node40
  61. tasks_from: config.yml
  62. vars:
  63. openshift_release_image: "{{ hostvars['localhost'].clusterversion.results.results[0].status.desired.image }}"