config.yml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. ---
  2. - name: Master Install Checkpoint Start
  3. hosts: oo_all_hosts
  4. gather_facts: false
  5. tasks:
  6. - name: Set Master install 'In Progress'
  7. set_stats:
  8. data:
  9. installer_phase_master: "In Progress"
  10. aggregate: false
  11. - include: certificates.yml
  12. - name: Disable excluders
  13. hosts: oo_masters_to_config
  14. gather_facts: no
  15. roles:
  16. - role: openshift_excluder
  17. r_openshift_excluder_action: disable
  18. r_openshift_excluder_service_type: "{{ openshift.common.service_type }}"
  19. - name: Gather and set facts for master hosts
  20. hosts: oo_masters_to_config
  21. pre_tasks:
  22. # Per https://bugzilla.redhat.com/show_bug.cgi?id=1469336
  23. #
  24. # When scaling up a cluster upgraded from OCP <= 3.5, ensure that
  25. # OPENSHIFT_DEFAULT_REGISTRY is present as defined on the existing
  26. # masters, or absent if such is the case.
  27. - name: Detect if this host is a new master in a scale up
  28. set_fact:
  29. g_openshift_master_is_scaleup: "{{ openshift.common.hostname in ( groups['new_masters'] | default([]) ) }}"
  30. - name: Scaleup Detection
  31. debug:
  32. var: g_openshift_master_is_scaleup
  33. - name: Check for RPM generated config marker file .config_managed
  34. stat:
  35. path: /etc/origin/.config_managed
  36. register: rpmgenerated_config
  37. - name: Remove RPM generated config files if present
  38. file:
  39. path: "/etc/origin/{{ item }}"
  40. state: absent
  41. when:
  42. - rpmgenerated_config.stat.exists == true
  43. - deployment_type == 'openshift-enterprise'
  44. with_items:
  45. - master
  46. - node
  47. - .config_managed
  48. - set_fact:
  49. 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 }}"
  50. openshift_master_etcd_hosts: "{{ hostvars
  51. | oo_select_keys(groups['oo_etcd_to_config']
  52. | default([]))
  53. | oo_collect('openshift.common.hostname')
  54. | default(none, true) }}"
  55. roles:
  56. - openshift_facts
  57. post_tasks:
  58. - openshift_facts:
  59. role: master
  60. local_facts:
  61. api_port: "{{ openshift_master_api_port | default(None) }}"
  62. api_url: "{{ openshift_master_api_url | default(None) }}"
  63. api_use_ssl: "{{ openshift_master_api_use_ssl | default(None) }}"
  64. controllers_port: "{{ openshift_master_controllers_port | default(None) }}"
  65. public_api_url: "{{ openshift_master_public_api_url | default(None) }}"
  66. cluster_hostname: "{{ openshift_master_cluster_hostname | default(None) }}"
  67. cluster_public_hostname: "{{ openshift_master_cluster_public_hostname | default(None) }}"
  68. console_path: "{{ openshift_master_console_path | default(None) }}"
  69. console_port: "{{ openshift_master_console_port | default(None) }}"
  70. console_url: "{{ openshift_master_console_url | default(None) }}"
  71. console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
  72. public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
  73. ha: "{{ openshift_master_ha | default(groups.oo_masters | length > 1) }}"
  74. master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}"
  75. - name: Inspect state of first master config settings
  76. hosts: oo_first_master
  77. roles:
  78. - role: openshift_facts
  79. post_tasks:
  80. - openshift_facts:
  81. role: master
  82. local_facts:
  83. session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(openshift.master.session_auth_secrets | default(None)) }}"
  84. session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(openshift.master.session_encryption_secrets | default(None)) }}"
  85. - name: Check for existing configuration
  86. stat:
  87. path: /etc/origin/master/master-config.yaml
  88. register: master_config_stat
  89. - name: Set clean install fact
  90. set_fact:
  91. l_clean_install: "{{ not master_config_stat.stat.exists | bool }}"
  92. - name: Determine if etcd3 storage is in use
  93. command: grep -Pzo "storage-backend:\n.*etcd3" /etc/origin/master/master-config.yaml -q
  94. register: etcd3_grep
  95. failed_when: false
  96. changed_when: false
  97. - name: Set etcd3 fact
  98. set_fact:
  99. l_etcd3_enabled: "{{ etcd3_grep.rc == 0 | bool }}"
  100. - name: Check if atomic-openshift-master sysconfig exists yet
  101. stat:
  102. path: /etc/sysconfig/atomic-openshift-master
  103. register: l_aom_exists
  104. - name: Preserve OPENSHIFT_DEFAULT_REGISTRY master parameter if present
  105. command: awk '/^OPENSHIFT_DEFAULT_REGISTRY/' /etc/sysconfig/atomic-openshift-master
  106. register: l_default_registry_defined
  107. when: l_aom_exists.stat.exists | bool
  108. - name: Check if atomic-openshift-master-api sysconfig exists yet
  109. stat:
  110. path: /etc/sysconfig/atomic-openshift-master-api
  111. register: l_aom_api_exists
  112. - name: Preserve OPENSHIFT_DEFAULT_REGISTRY master-api parameter if present
  113. command: awk '/^OPENSHIFT_DEFAULT_REGISTRY/' /etc/sysconfig/atomic-openshift-master-api
  114. register: l_default_registry_defined_api
  115. when: l_aom_api_exists.stat.exists | bool
  116. - name: Check if atomic-openshift-master-controllers sysconfig exists yet
  117. stat:
  118. path: /etc/sysconfig/atomic-openshift-master-controllers
  119. register: l_aom_controllers_exists
  120. - name: Preserve OPENSHIFT_DEFAULT_REGISTRY master-controllers parameter if present
  121. command: awk '/^OPENSHIFT_DEFAULT_REGISTRY/' /etc/sysconfig/atomic-openshift-master-controllers
  122. register: l_default_registry_defined_controllers
  123. when: l_aom_controllers_exists.stat.exists | bool
  124. - name: Update facts with OPENSHIFT_DEFAULT_REGISTRY value
  125. set_fact:
  126. l_default_registry_value: "{{ l_default_registry_defined.stdout | default('') }}"
  127. l_default_registry_value_api: "{{ l_default_registry_defined_api.stdout | default('') }}"
  128. l_default_registry_value_controllers: "{{ l_default_registry_defined_controllers.stdout | default('') }}"
  129. - name: Generate master session secrets
  130. hosts: oo_first_master
  131. vars:
  132. g_session_secrets_present: "{{ (openshift.master.session_auth_secrets | default([])) | length > 0 and (openshift.master.session_encryption_secrets | default([])) | length > 0 }}"
  133. g_session_auth_secrets: "{{ [ 24 | oo_generate_secret ] }}"
  134. g_session_encryption_secrets: "{{ [ 24 | oo_generate_secret ] }}"
  135. roles:
  136. - role: openshift_facts
  137. tasks:
  138. - openshift_facts:
  139. role: master
  140. local_facts:
  141. session_auth_secrets: "{{ g_session_auth_secrets }}"
  142. session_encryption_secrets: "{{ g_session_encryption_secrets }}"
  143. when: not g_session_secrets_present | bool
  144. - name: Configure masters
  145. hosts: oo_masters_to_config
  146. any_errors_fatal: true
  147. vars:
  148. openshift_master_ha: "{{ openshift.master.ha }}"
  149. openshift_master_count: "{{ openshift.master.master_count }}"
  150. openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}"
  151. openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
  152. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  153. openshift_master_etcd_hosts: "{{ hostvars
  154. | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  155. | oo_collect('openshift.common.hostname')
  156. | default(none, true) }}"
  157. openshift_no_proxy_etcd_host_ips: "{{ hostvars | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  158. | oo_collect('openshift.common.ip') | default([]) | join(',')
  159. }}"
  160. roles:
  161. - role: os_firewall
  162. - role: openshift_master_facts
  163. - role: openshift_hosted_facts
  164. - role: openshift_clock
  165. - role: openshift_cloud_provider
  166. - role: openshift_builddefaults
  167. - role: openshift_buildoverrides
  168. - role: nickhammond.logrotate
  169. - role: contiv
  170. contiv_role: netmaster
  171. when: openshift_use_contiv | default(False) | bool
  172. - role: openshift_master
  173. openshift_master_hosts: "{{ groups.oo_masters_to_config }}"
  174. r_openshift_master_clean_install: "{{ hostvars[groups.oo_first_master.0].l_clean_install }}"
  175. r_openshift_master_etcd3_storage: "{{ hostvars[groups.oo_first_master.0].l_etcd3_enabled }}"
  176. openshift_master_is_scaleup_host: "{{ g_openshift_master_is_scaleup | default(false) }}"
  177. openshift_master_default_registry_value: "{{ hostvars[groups.oo_first_master.0].l_default_registry_value }}"
  178. openshift_master_default_registry_value_api: "{{ hostvars[groups.oo_first_master.0].l_default_registry_value_api }}"
  179. openshift_master_default_registry_value_controllers: "{{ hostvars[groups.oo_first_master.0].l_default_registry_value_controllers }}"
  180. - role: tuned
  181. - role: nuage_ca
  182. when: openshift_use_nuage | default(false) | bool
  183. - role: nuage_common
  184. when: openshift_use_nuage | default(false) | bool
  185. - role: nuage_master
  186. when: openshift_use_nuage | default(false) | bool
  187. - role: calico_master
  188. when: openshift_use_calico | default(false) | bool
  189. tasks:
  190. - include_role:
  191. name: kuryr
  192. tasks_from: master
  193. when: openshift_use_kuryr | default(false) | bool
  194. post_tasks:
  195. - name: Create group for deployment type
  196. group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }}
  197. changed_when: False
  198. - name: Configure API Aggregation on masters
  199. hosts: oo_masters
  200. serial: 1
  201. tasks:
  202. - include: tasks/wire_aggregator.yml
  203. - name: Re-enable excluder if it was previously enabled
  204. hosts: oo_masters_to_config
  205. gather_facts: no
  206. roles:
  207. - role: openshift_excluder
  208. r_openshift_excluder_action: enable
  209. r_openshift_excluder_service_type: "{{ openshift.common.service_type }}"
  210. - name: Master Install Checkpoint End
  211. hosts: oo_all_hosts
  212. gather_facts: false
  213. tasks:
  214. - name: Set Master install 'Complete'
  215. set_stats:
  216. data:
  217. installer_phase_master: "Complete"
  218. aggregate: false