set_network_facts.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. - name: Read first master\'s config
  3. hosts: oo_first_master
  4. gather_facts: no
  5. tasks:
  6. - stat:
  7. path: "{{ openshift.common.config_base }}/master/master-config.yaml"
  8. register: g_master_config_stat
  9. - slurp:
  10. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  11. register: g_master_config_slurp
  12. - name: Set network facts for masters
  13. hosts: oo_masters_to_config
  14. gather_facts: no
  15. roles:
  16. - role: openshift_facts
  17. post_tasks:
  18. - block:
  19. - set_fact:
  20. osm_cluster_network_cidr: "{{ (hostvars[groups.oo_first_master.0].g_master_config_slurp.content|b64decode|from_yaml).networkConfig.clusterNetworkCIDR }}"
  21. when: osm_cluster_network_cidr is not defined
  22. - set_fact:
  23. osm_host_subnet_length: "{{ (hostvars[groups.oo_first_master.0].g_master_config_slurp.content|b64decode|from_yaml).networkConfig.hostSubnetLength }}"
  24. when: osm_host_subnet_length is not defined
  25. - set_fact:
  26. openshift_portal_net: "{{ (hostvars[groups.oo_first_master.0].g_master_config_slurp.content|b64decode|from_yaml).networkConfig.serviceNetworkCIDR }}"
  27. when: openshift_portal_net is not defined
  28. - openshift_facts:
  29. role: common
  30. local_facts:
  31. portal_net: "{{ openshift_portal_net | default(openshift_master_portal_net) | default(None) }}"
  32. when:
  33. - hostvars[groups.oo_first_master.0].g_master_config_stat.stat.exists | bool