config.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. - name: "node/config.yml, 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. gather_facts: yes
  14. tasks:
  15. - command: 'curl "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip" -H "Metadata-Flavor: Google"'
  16. register: output
  17. - set_fact: gce_public_ip="{{ output.stdout }}"
  18. - name: "Set OO sepcific facts on localhost (for later use)"
  19. hosts: localhost
  20. gather_facts: no
  21. tasks:
  22. - name: Setting openshift_master_ips fact on localhost
  23. set_fact:
  24. openshift_master_ips: "{{ hostvars
  25. | oo_select_keys(groups['tag_env-host-type-' + oo_env + '-openshift-master'])
  26. | oo_collect(attribute='ansible_default_ipv4.address') }}"
  27. when: groups['tag_env-host-type-' + oo_env + '-openshift-master'] is defined
  28. - name: Setting openshift_master_public_ips fact on localhost
  29. set_fact:
  30. openshift_master_public_ips: "{{ hostvars
  31. | oo_select_keys(groups['tag_env-host-type-' + oo_env + '-openshift-master'])
  32. | oo_collect(attribute='gce_public_ip') }}"
  33. when: groups['tag_env-host-type-' + oo_env + '-openshift-master'] is defined
  34. - name: "Configure instances"
  35. hosts: oo_hosts_to_config
  36. connection: ssh
  37. user: root
  38. vars_files:
  39. - vars.yml
  40. tasks:
  41. - debug: var=gce_public_ip
  42. roles:
  43. - {
  44. role: openshift_node,
  45. openshift_master_ips: "{{ hostvars['localhost'].openshift_master_ips | default(['']) }}",
  46. openshift_master_public_ips: "{{ hostvars['localhost'].openshift_master_public_ips | default(['']) }}",
  47. openshift_public_ip: "{{ gce_public_ip }}",
  48. openshift_env: "{{ oo_env }}",
  49. }
  50. - docker
  51. - os_env_extras