config.yml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. - openshift_facts:
  72. role: hosted
  73. openshift_env:
  74. openshift_hosted_registry_storage_kind: 'nfs'
  75. when: openshift_hosted_registry_storage_kind is not defined and groups.oo_nfs_to_config is defined and groups.oo_nfs_to_config | length > 0
  76. - name: Create temp directory for syncing certs
  77. hosts: localhost
  78. connection: local
  79. become: no
  80. gather_facts: no
  81. tasks:
  82. - name: Create local temp directory for syncing certs
  83. local_action: command mktemp -d /tmp/openshift-ansible-XXXXXXX
  84. register: g_master_mktemp
  85. changed_when: False
  86. - name: Determine if session secrets must be generated
  87. hosts: oo_first_master
  88. roles:
  89. - role: openshift_facts
  90. post_tasks:
  91. - openshift_facts:
  92. role: master
  93. local_facts:
  94. session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(openshift.master.session_auth_secrets | default(None)) }}"
  95. session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(openshift.master.session_encryption_secrets | default(None)) }}"
  96. - name: Generate master session secrets
  97. hosts: oo_first_master
  98. vars:
  99. g_session_secrets_present: "{{ (openshift.master.session_auth_secrets | default([])) | length > 0 and (openshift.master.session_encryption_secrets | default([])) | length > 0 }}"
  100. g_session_auth_secrets: "{{ [ 24 | oo_generate_secret ] }}"
  101. g_session_encryption_secrets: "{{ [ 24 | oo_generate_secret ] }}"
  102. roles:
  103. - role: openshift_facts
  104. tasks:
  105. - openshift_facts:
  106. role: master
  107. local_facts:
  108. session_auth_secrets: "{{ g_session_auth_secrets }}"
  109. session_encryption_secrets: "{{ g_session_encryption_secrets }}"
  110. when: not g_session_secrets_present | bool
  111. - name: Configure masters
  112. hosts: oo_masters_to_config
  113. any_errors_fatal: true
  114. vars:
  115. sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}"
  116. openshift_master_ha: "{{ openshift.master.ha }}"
  117. openshift_master_count: "{{ openshift.master.master_count }}"
  118. openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}"
  119. openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
  120. openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
  121. | union(groups['oo_masters_to_config'])
  122. | union(groups['oo_etcd_to_config'] | default([])))
  123. | oo_collect('openshift.common.hostname') | default([]) | join (',')
  124. }}"
  125. roles:
  126. - role: openshift_master_facts
  127. - role: openshift_hosted_facts
  128. - role: openshift_master_certificates
  129. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  130. openshift_master_etcd_hosts: "{{ hostvars
  131. | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  132. | oo_collect('openshift.common.hostname')
  133. | default(none, true) }}"
  134. openshift_master_hostnames: "{{ hostvars
  135. | oo_select_keys(groups['oo_masters_to_config'] | default([]))
  136. | oo_collect('openshift.common.all_hostnames')
  137. | oo_flatten | unique }}"
  138. - role: openshift_etcd_client_certificates
  139. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  140. etcd_cert_subdir: "openshift-master-{{ openshift.common.hostname }}"
  141. etcd_cert_config_dir: "{{ openshift.common.config_base }}/master"
  142. etcd_cert_prefix: "master.etcd-"
  143. when: groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config
  144. - role: openshift_clock
  145. - role: openshift_cloud_provider
  146. - role: openshift_builddefaults
  147. - role: os_firewall
  148. os_firewall_allow:
  149. - service: etcd embedded
  150. port: 4001/tcp
  151. - service: api server https
  152. port: "{{ openshift.master.api_port }}/tcp"
  153. - service: api controllers https
  154. port: "{{ openshift.master.controllers_port }}/tcp"
  155. - service: skydns tcp
  156. port: "{{ openshift.master.dns_port }}/tcp"
  157. - service: skydns udp
  158. port: "{{ openshift.master.dns_port }}/udp"
  159. - service: Fluentd td-agent tcp
  160. port: 24224/tcp
  161. - service: Fluentd td-agent udp
  162. port: 24224/udp
  163. - service: pcsd
  164. port: 2224/tcp
  165. - service: Corosync UDP
  166. port: 5404/udp
  167. - service: Corosync UDP
  168. port: 5405/udp
  169. - role: openshift_master
  170. openshift_master_hosts: "{{ groups.oo_masters_to_config }}"
  171. - role: nickhammond.logrotate
  172. - role: nuage_master
  173. when: openshift.common.use_nuage | bool
  174. post_tasks:
  175. - name: Create group for deployment type
  176. group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }}
  177. changed_when: False
  178. - name: Delete temporary directory on localhost
  179. hosts: localhost
  180. connection: local
  181. become: no
  182. gather_facts: no
  183. tasks:
  184. - file: name={{ g_master_mktemp.stdout }} state=absent
  185. changed_when: False