config.yml 9.5 KB

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