launch.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. - name: Launch instance(s)
  2. hosts: localhost
  3. connection: local
  4. gather_facts: no
  5. vars:
  6. libvirt_storage_pool_path: "{{ lookup('env','HOME') }}/libvirt-storage-pool-openshift"
  7. libvirt_storage_pool: 'openshift'
  8. libvirt_uri: 'qemu:///system'
  9. vars_files:
  10. - vars.yml
  11. tasks:
  12. - set_fact:
  13. k8s_type: master
  14. - name: Generate master instance name(s)
  15. set_fact:
  16. scratch_name: "{{ cluster_id }}-{{ k8s_type }}-{{ '%05x' | format( 1048576 | random ) }}"
  17. register: master_names_output
  18. with_sequence: start=1 end='{{ num_masters }}'
  19. - set_fact:
  20. master_names: "{{ master_names_output.results | oo_collect('ansible_facts') | oo_collect('scratch_name') }}"
  21. - include: launch_instances.yml
  22. vars:
  23. instances: '{{ master_names }}'
  24. cluster: '{{ cluster_id }}'
  25. type: '{{ k8s_type }}'
  26. group_name: 'tag_env-host-type-{{ cluster_id }}-openshift-master'
  27. - set_fact:
  28. k8s_type: node
  29. - name: Generate node instance name(s)
  30. set_fact:
  31. scratch_name: "{{ cluster_id }}-{{ k8s_type }}-{{ '%05x' | format( 1048576 | random ) }}"
  32. register: node_names_output
  33. with_sequence: start=1 end='{{ num_nodes }}'
  34. - set_fact:
  35. node_names: "{{ node_names_output.results | oo_collect('ansible_facts') | oo_collect('scratch_name') }}"
  36. - include: launch_instances.yml
  37. vars:
  38. instances: '{{ node_names }}'
  39. cluster: '{{ cluster_id }}'
  40. type: '{{ k8s_type }}'
  41. - hosts: 'tag_env-{{ cluster_id }}'
  42. roles:
  43. - openshift_repos
  44. - os_update_latest
  45. - include: ../openshift-master/config.yml
  46. vars:
  47. oo_host_group_exp: 'groups["tag_env-host-type-{{ cluster_id }}-openshift-master"]'
  48. oo_env: '{{ cluster_id }}'
  49. - include: ../openshift-node/config.yml
  50. vars:
  51. oo_host_group_exp: 'groups["tag_env-host-type-{{ cluster_id }}-openshift-node"]'
  52. oo_env: '{{ cluster_id }}'