pre_tasks.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. - name: Generate Environment ID
  3. set_fact:
  4. env_random_id: "{{ ansible_date_time.epoch }}"
  5. run_once: true
  6. delegate_to: localhost
  7. - name: Set default Environment ID
  8. set_fact:
  9. default_env_id: "openshift-{{ lookup('env','OS_USERNAME') }}-{{ env_random_id }}"
  10. delegate_to: localhost
  11. - name: Setting Common Facts
  12. set_fact:
  13. env_id: "{{ env_id | default(default_env_id) }}"
  14. delegate_to: localhost
  15. - name: Updating DNS domain to include env_id (if not empty)
  16. set_fact:
  17. full_dns_domain: "{{ (env_id|trim == '') | ternary(public_dns_domain, env_id + '.' + public_dns_domain) }}"
  18. delegate_to: localhost
  19. - name: Set the APP domain for OpenShift use
  20. set_fact:
  21. openshift_app_domain: "{{ openshift_app_domain | default('apps') }}"
  22. delegate_to: localhost
  23. - name: Set the default app domain for routing purposes
  24. set_fact:
  25. openshift_master_default_subdomain: "{{ openshift_app_domain }}.{{ full_dns_domain }}"
  26. delegate_to: localhost
  27. when:
  28. - openshift_master_default_subdomain is undefined
  29. # Check that openshift_cluster_node_labels has regions defined for all groups
  30. # NOTE(kpilatov): if node labels are to be enabled for more groups,
  31. # this check needs to be modified as well
  32. - name: Set openshift_cluster_node_labels if undefined (should not happen)
  33. set_fact:
  34. openshift_cluster_node_labels: {'app': {'region': 'primary'}, 'infra': {'region': 'infra'}}
  35. when: openshift_cluster_node_labels is not defined
  36. - name: Set openshift_cluster_node_labels for the infra group
  37. set_fact:
  38. openshift_cluster_node_labels: "{{ openshift_cluster_node_labels | combine({'infra': {'region': 'infra'}}, recursive=True) }}"
  39. - name: Set openshift_cluster_node_labels for the app group
  40. set_fact:
  41. openshift_cluster_node_labels: "{{ openshift_cluster_node_labels | combine({'app': {'region': 'primary'}}, recursive=True) }}"
  42. - name: Set openshift_cluster_node_labels for auto-scaling app nodes
  43. set_fact:
  44. openshift_cluster_node_labels: "{{ openshift_cluster_node_labels | combine({'app': {'autoscaling': 'app'}}, recursive=True) }}"