config.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ---
  2. - name: Gather and set facts for master hosts
  3. hosts: oo_masters_to_config
  4. vars:
  5. t_oo_option_master_debug_level: "{{ lookup('oo_option', 'openshift_master_debug_level') }}"
  6. pre_tasks:
  7. - name: Check for RPM generated config marker file .config_managed
  8. stat:
  9. path: /etc/origin/.config_managed
  10. register: rpmgenerated_config
  11. - name: Remove RPM generated config files if present
  12. file:
  13. path: "/etc/origin/{{ item }}"
  14. state: absent
  15. when: rpmgenerated_config.stat.exists == true and deployment_type in ['openshift-enterprise', 'atomic-enterprise']
  16. with_items:
  17. - master
  18. - node
  19. - .config_managed
  20. - set_fact:
  21. openshift_master_pod_eviction_timeout: "{{ lookup('oo_option', 'openshift_master_pod_eviction_timeout') | default(none, true) }}"
  22. when: openshift_master_pod_eviction_timeout is not defined
  23. - set_fact:
  24. openshift_master_etcd_port: "{{ (etcd_client_port | default('2379')) if (groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config) else none }}"
  25. openshift_master_etcd_hosts: "{{ hostvars
  26. | oo_select_keys(groups['oo_etcd_to_config']
  27. | default([]))
  28. | oo_collect('openshift.common.hostname')
  29. | default(none, true) }}"
  30. - set_fact:
  31. openshift_master_debug_level: "{{ t_oo_option_master_debug_level }}"
  32. when: openshift_master_debug_level is not defined and t_oo_option_master_debug_level != ""
  33. - set_fact:
  34. openshift_master_default_subdomain: "{{ lookup('oo_option', 'openshift_master_default_subdomain') | default(None, true) }}"
  35. when: openshift_master_default_subdomain is not defined
  36. - set_fact:
  37. openshift_hosted_metrics_deploy: "{{ lookup('oo_option', 'openshift_hosted_metrics_deploy') | default(false, true) }}"
  38. when: openshift_hosted_metrics_deploy is not defined
  39. - set_fact:
  40. openshift_hosted_metrics_duration: "{{ lookup('oo_option', 'openshift_hosted_metrics_duration') | default(7) }}"
  41. when: openshift_hosted_metrics_duration is not defined
  42. - set_fact:
  43. openshift_hosted_metrics_resolution: "{{ lookup('oo_option', 'openshift_hosted_metrics_resolution') | default('10s', true) }}"
  44. when: openshift_hosted_metrics_resolution is not defined
  45. - set_fact:
  46. openshift_hosted_metrics_deployer_prefix: "{{ lookup('oo_option', 'openshift_hosted_metrics_deployer_prefix') | default('openshift') }}"
  47. when: openshift_hosted_metrics_deployer_prefix is not defined
  48. - set_fact:
  49. openshift_hosted_metrics_deployer_version: "{{ lookup('oo_option', 'openshift_hosted_metrics_deployer_version') | default('latest') }}"
  50. when: openshift_hosted_metrics_deployer_version is not defined
  51. roles:
  52. - openshift_facts
  53. post_tasks:
  54. - openshift_facts:
  55. role: master
  56. local_facts:
  57. api_port: "{{ openshift_master_api_port | default(None) }}"
  58. api_url: "{{ openshift_master_api_url | default(None) }}"
  59. api_use_ssl: "{{ openshift_master_api_use_ssl | default(None) }}"
  60. controllers_port: "{{ openshift_master_controllers_port | default(None) }}"
  61. public_api_url: "{{ openshift_master_public_api_url | default(None) }}"
  62. cluster_hostname: "{{ openshift_master_cluster_hostname | default(None) }}"
  63. cluster_public_hostname: "{{ openshift_master_cluster_public_hostname | default(None) }}"
  64. console_path: "{{ openshift_master_console_path | default(None) }}"
  65. console_port: "{{ openshift_master_console_port | default(None) }}"
  66. console_url: "{{ openshift_master_console_url | default(None) }}"
  67. console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
  68. public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
  69. ha: "{{ openshift_master_ha | default(groups.oo_masters | length > 1) }}"
  70. master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}"
  71. - name: Determine if session secrets must be generated
  72. hosts: oo_first_master
  73. roles:
  74. - role: openshift_facts
  75. post_tasks:
  76. - openshift_facts:
  77. role: master
  78. local_facts:
  79. session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(openshift.master.session_auth_secrets | default(None)) }}"
  80. session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(openshift.master.session_encryption_secrets | default(None)) }}"
  81. - name: Generate master session secrets
  82. hosts: oo_first_master
  83. vars:
  84. g_session_secrets_present: "{{ (openshift.master.session_auth_secrets | default([])) | length > 0 and (openshift.master.session_encryption_secrets | default([])) | length > 0 }}"
  85. g_session_auth_secrets: "{{ [ 24 | oo_generate_secret ] }}"
  86. g_session_encryption_secrets: "{{ [ 24 | oo_generate_secret ] }}"
  87. roles:
  88. - role: openshift_facts
  89. tasks:
  90. - openshift_facts:
  91. role: master
  92. local_facts:
  93. session_auth_secrets: "{{ g_session_auth_secrets }}"
  94. session_encryption_secrets: "{{ g_session_encryption_secrets }}"
  95. when: not g_session_secrets_present | bool
  96. - name: Configure masters
  97. hosts: oo_masters_to_config
  98. any_errors_fatal: true
  99. vars:
  100. openshift_master_ha: "{{ openshift.master.ha }}"
  101. openshift_master_count: "{{ openshift.master.master_count }}"
  102. openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}"
  103. openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
  104. openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
  105. | union(groups['oo_masters_to_config'])
  106. | union(groups['oo_etcd_to_config'] | default([])))
  107. | oo_collect('openshift.common.hostname') | default([]) | join (',')
  108. }}"
  109. roles:
  110. - role: openshift_master
  111. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  112. openshift_master_etcd_hosts: "{{ hostvars
  113. | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  114. | oo_collect('openshift.common.hostname')
  115. | default(none, true) }}"
  116. openshift_master_hosts: "{{ groups.oo_masters_to_config }}"
  117. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  118. etcd_cert_subdir: "openshift-master-{{ openshift.common.hostname }}"
  119. etcd_cert_config_dir: "{{ openshift.common.config_base }}/master"
  120. etcd_cert_prefix: "master.etcd-"
  121. - role: nuage_master
  122. when: openshift.common.use_nuage | bool
  123. - role: calico_master
  124. when: openshift.common.use_calico | bool
  125. post_tasks:
  126. - name: Create group for deployment type
  127. group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }}
  128. changed_when: False