config.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. - name: "populate oo_hosts_to_config host group if needed"
  2. hosts: localhost
  3. gather_facts: no
  4. tasks:
  5. - name: Evaluate oo_host_group_exp
  6. add_host: "name={{ item }} groups=oo_hosts_to_config"
  7. with_items: "{{ oo_host_group_exp | default('') }}"
  8. when: oo_host_group_exp is defined
  9. - name: "Gather facts for masters in {{ oo_env }}"
  10. hosts: "tag_env-host-type-{{ oo_env }}-openshift-master"
  11. connection: ssh
  12. user: root
  13. - name: "Set OO sepcific facts on localhost (for later use)"
  14. hosts: localhost
  15. gather_facts: no
  16. tasks:
  17. - name: Setting oo_master_ips fact on localhost
  18. set_fact:
  19. oo_master_ips: "{{ hostvars
  20. | oo_select_keys(groups['tag_env-host-type-' + oo_env + '-openshift-master'])
  21. | oo_collect(attribute='ansible_eth0.ipv4.address') }}"
  22. when: groups['tag_env-host-type-' + oo_env + '-openshift-master'] is defined
  23. - name: Setting oo_master_public_ips fact on localhost
  24. set_fact:
  25. oo_master_public_ips: "{{ hostvars
  26. | oo_select_keys(groups['tag_env-host-type-' + oo_env + '-openshift-master'])
  27. | oo_collect(attribute='gce_public_ip') }}"
  28. when: groups['tag_env-host-type-' + oo_env + '-openshift-master'] is defined
  29. - name: "Configure instances"
  30. hosts: oo_hosts_to_config
  31. connection: ssh
  32. user: root
  33. vars_files:
  34. - vars.yml
  35. roles:
  36. - ../../../roles/base_os
  37. - ../../../roles/repos
  38. - ../../../roles/docker
  39. - {
  40. role: ../../../roles/openshift_node,
  41. oo_master_ips: "{{ hostvars['localhost'].oo_master_ips | default(['']) }}",
  42. oo_master_public_ips: "{{ hostvars['localhost'].oo_master_public_ips | default(['']) }}",
  43. oo_bind_ip: "{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address | default(['']) }}",
  44. oo_public_ip: "{{ hostvars[inventory_hostname].ansible_ssh_host }}"
  45. }