config.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ---
  2. - name: Populate config host groups
  3. hosts: localhost
  4. gather_facts: no
  5. tasks:
  6. - fail:
  7. msg: This playbook rquires g_etcd_group to be set
  8. when: g_etcd_group is not defined
  9. - fail:
  10. msg: This playbook rquires g_masters_group to be set
  11. when: g_masters_group is not defined
  12. - fail:
  13. msg: This playbook rquires g_nodes_group to be set
  14. when: g_nodes_group is not defined
  15. - name: Evaluate oo_etcd_to_config
  16. add_host:
  17. name: "{{ item }}"
  18. groups: oo_etcd_to_config
  19. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  20. ansible_sudo: "{{ g_sudo | default(omit) }}"
  21. with_items: groups[g_etcd_group] | default([])
  22. - name: Evaluate oo_masters_to_config
  23. add_host:
  24. name: "{{ item }}"
  25. groups: oo_masters_to_config
  26. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  27. ansible_sudo: "{{ g_sudo | default(omit) }}"
  28. with_items: groups[g_masters_group] | default([])
  29. - name: Evaluate oo_nodes_to_config
  30. add_host:
  31. name: "{{ item }}"
  32. groups: oo_nodes_to_config
  33. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  34. ansible_sudo: "{{ g_sudo | default(omit) }}"
  35. with_items: groups[g_nodes_group] | default([])
  36. - name: Evaluate oo_first_etcd
  37. add_host:
  38. name: "{{ groups[g_etcd_group][0] }}"
  39. groups: oo_first_etcd
  40. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  41. ansible_sudo: "{{ g_sudo | default(omit) }}"
  42. when: g_etcd_group in groups and (groups[g_etcd_group] | length) > 0
  43. - name: Evaluate oo_first_master
  44. add_host:
  45. name: "{{ groups[g_masters_group][0] }}"
  46. groups: oo_first_master
  47. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  48. ansible_sudo: "{{ g_sudo | default(omit) }}"
  49. when: g_masters_group in groups and (groups[g_masters_group] | length) > 0
  50. - include: ../openshift-etcd/config.yml
  51. - include: ../openshift-master/config.yml
  52. - include: ../openshift-node/config.yml
  53. vars:
  54. osn_cluster_dns_domain: "{{ hostvars[groups.oo_first_master.0].openshift.dns.domain }}"
  55. osn_cluster_dns_ip: "{{ hostvars[groups.oo_first_master.0].openshift.dns.ip }}"