main.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. ---
  2. - name: Validate Elasticsearch cluster size
  3. fail: msg="The openshift_logging_es_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
  4. when: openshift_logging_facts.elasticsearch.deploymentconfigs | length > openshift_logging_es_cluster_size|int
  5. - name: Validate Elasticsearch Ops cluster size
  6. fail: msg="The openshift_logging_es_ops_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
  7. when: openshift_logging_facts.elasticsearch_ops.deploymentconfigs | length > openshift_logging_es_ops_cluster_size|int
  8. - fail:
  9. msg: Invalid deployment type, one of ['data-master', 'data-client', 'master', 'client'] allowed
  10. when: not openshift_logging_elasticsearch_deployment_type in __allowed_es_types
  11. - set_fact:
  12. elasticsearch_name: "{{ 'logging-elasticsearch' ~ ( (openshift_logging_elasticsearch_ops_deployment | default(false) | bool) | ternary('-ops', '')) }}"
  13. es_component: "{{ 'es' ~ ( (openshift_logging_elasticsearch_ops_deployment | default(false) | bool) | ternary('-ops', '') ) }}"
  14. - name: Set default image variables based on openshift_deployment_type
  15. include_vars: "{{ var_file_name }}"
  16. with_first_found:
  17. - "{{ openshift_deployment_type }}.yml"
  18. - "default_images.yml"
  19. loop_control:
  20. loop_var: var_file_name
  21. - name: Set elasticsearch image facts
  22. set_fact:
  23. openshift_logging_elasticsearch_proxy_image_prefix: "{{ openshift_logging_elasticsearch_proxy_image_prefix | default(__openshift_logging_elasticsearch_proxy_image_prefix) }}"
  24. openshift_logging_elasticsearch_proxy_image_version: "{{ openshift_logging_elasticsearch_proxy_image_version | default(__openshift_logging_elasticsearch_proxy_image_version) }}"
  25. openshift_logging_elasticsearch_image_prefix: "{{ openshift_logging_elasticsearch_image_prefix | default(__openshift_logging_elasticsearch_image_prefix) }}"
  26. openshift_logging_elasticsearch_image_version: "{{ openshift_logging_elasticsearch_image_version | default(__openshift_logging_elasticsearch_image_version) }}"
  27. - include_tasks: determine_version.yaml
  28. - set_fact:
  29. full_restart_cluster: True
  30. when:
  31. - _es_installed_version is defined
  32. - _es_installed_version.split('.')[0] | int < __es_version.split('.')[0] | int
  33. - set_fact:
  34. full_restart_cluster: True
  35. when:
  36. - _es_ops_installed_version is defined
  37. - _es_ops_installed_version.split('.')[0] | int < __es_version.split('.')[0] | int
  38. # allow passing in a tempdir
  39. - name: Create temp directory for doing work in
  40. command: mktemp -d /tmp/openshift-logging-ansible-XXXXXX
  41. register: mktemp
  42. changed_when: False
  43. - set_fact:
  44. tempdir: "{{ mktemp.stdout }}"
  45. # This may not be necessary in this role
  46. - name: Create templates subdirectory
  47. file:
  48. state: directory
  49. path: "{{ tempdir }}/templates"
  50. mode: 0755
  51. changed_when: False
  52. # we want to make sure we have all the necessary components here
  53. # service account
  54. - name: Create ES service account
  55. oc_serviceaccount:
  56. state: present
  57. name: "aggregated-logging-elasticsearch"
  58. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  59. image_pull_secrets: "{{ openshift_logging_image_pull_secret }}"
  60. when: openshift_logging_image_pull_secret != ''
  61. - name: Create ES service account
  62. oc_serviceaccount:
  63. state: present
  64. name: "aggregated-logging-elasticsearch"
  65. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  66. when:
  67. - openshift_logging_image_pull_secret == ''
  68. # rolebinding reader
  69. - name: Create rolebinding-reader role
  70. oc_clusterrole:
  71. state: present
  72. name: rolebinding-reader
  73. rules:
  74. - apiGroups: [""]
  75. resources: ["clusterrolebindings"]
  76. verbs: ["get"]
  77. # SA roles
  78. - name: Set rolebinding-reader permissions for ES
  79. oc_adm_policy_user:
  80. state: present
  81. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  82. resource_kind: cluster-role
  83. resource_name: rolebinding-reader
  84. user: "system:serviceaccount:{{ openshift_logging_elasticsearch_namespace }}:aggregated-logging-elasticsearch"
  85. - oc_adm_policy_user:
  86. state: present
  87. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  88. resource_kind: cluster-role
  89. resource_name: system:auth-delegator
  90. user: "system:serviceaccount:{{ openshift_logging_elasticsearch_namespace}}:aggregated-logging-elasticsearch"
  91. # logging-metrics-reader role
  92. - template:
  93. src: "{{ __base_file_dir }}/logging-metrics-role.j2"
  94. dest: "{{mktemp.stdout}}/templates/logging-metrics-role.yml"
  95. vars:
  96. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  97. role_namespace: "{{ openshift_logging_elasticsearch_prometheus_sa | serviceaccount_namespace(openshift_logging_elasticsearch_namespace) }}"
  98. role_user: "{{ openshift_logging_elasticsearch_prometheus_sa | serviceaccount_name }}"
  99. - name: Create logging-metrics-reader-role
  100. command: >
  101. {{ openshift_client_binary }}
  102. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  103. -n "{{ openshift_logging_elasticsearch_namespace }}"
  104. create -f "{{mktemp.stdout}}/templates/logging-metrics-role.yml"
  105. register: prometheus_out
  106. check_mode: no
  107. ignore_errors: yes
  108. - fail:
  109. msg: "There was an error creating the logging-metrics-role and binding: {{prometheus_out}}"
  110. when:
  111. - "prometheus_out.stderr | length > 0"
  112. - "'already exists' not in prometheus_out.stderr"
  113. - set_fact:
  114. _logging_metrics_proxy_passwd: "{{ 16 | lib_utils_oo_random_word | b64encode }}"
  115. - template:
  116. src: passwd.j2
  117. dest: "{{mktemp.stdout}}/passwd.yml"
  118. vars:
  119. logging_user_name: "{{ openshift_logging_elasticsearch_prometheus_sa }}"
  120. logging_user_passwd: "{{ _logging_metrics_proxy_passwd }}"
  121. # View role and binding
  122. - name: Generate logging-elasticsearch-view-role
  123. template:
  124. src: "{{ __base_file_dir }}/rolebinding.j2"
  125. dest: "{{mktemp.stdout}}/logging-elasticsearch-view-role.yaml"
  126. vars:
  127. obj_name: logging-elasticsearch-view-role
  128. roleRef:
  129. name: view
  130. subjects:
  131. - kind: ServiceAccount
  132. name: aggregated-logging-elasticsearch
  133. changed_when: no
  134. - name: Set logging-elasticsearch-view-role role
  135. oc_obj:
  136. state: present
  137. name: "logging-elasticsearch-view-role"
  138. kind: rolebinding
  139. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  140. files:
  141. - "{{ tempdir }}/logging-elasticsearch-view-role.yaml"
  142. delete_after: true
  143. # configmap
  144. - assert:
  145. that:
  146. - openshift_logging_elasticsearch_kibana_index_mode in __kibana_index_modes
  147. msg: "The openshift_logging_elasticsearch_kibana_index_mode '{{ openshift_logging_elasticsearch_kibana_index_mode }}' only supports one of: {{ __kibana_index_modes | join(', ') }}"
  148. - assert:
  149. that:
  150. - "{{ openshift_logging_es_log_appenders | length > 0 }}"
  151. msg: "The openshift_logging_es_log_appenders '{{ openshift_logging_es_log_appenders }}' has an unrecognized option and only supports the following as a list: {{ __es_log_appenders | join(', ') }}"
  152. - template:
  153. src: "{{ __base_file_dir }}/elasticsearch.yml.j2"
  154. dest: "{{ tempdir }}/elasticsearch.yml"
  155. vars:
  156. allow_cluster_reader: "{{ openshift_logging_elasticsearch_ops_allow_cluster_reader | lower | default('false') }}"
  157. es_number_of_shards: "{{ openshift_logging_es_number_of_shards | default(1) }}"
  158. es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas| default(0) }}"
  159. es_kibana_index_mode: "{{ openshift_logging_elasticsearch_kibana_index_mode | default('unique') }}"
  160. changed_when: no
  161. # create diff between current configmap files and our current files
  162. - when: not openshift_logging_es5_techpreview
  163. block:
  164. - template:
  165. src: "{{ __base_file_dir }}/elasticsearch-logging.yml.j2"
  166. dest: "{{ tempdir }}/elasticsearch-logging.yml"
  167. vars:
  168. root_logger: "{{openshift_logging_es_log_appenders | join(', ')}}"
  169. changed_when: no
  170. - include_role:
  171. name: openshift_logging
  172. tasks_from: patch_configmap_files.yaml
  173. vars:
  174. configmap_name: "logging-elasticsearch"
  175. configmap_namespace: "logging"
  176. configmap_file_names:
  177. - current_file: "elasticsearch.yml"
  178. new_file: "{{ tempdir }}/elasticsearch.yml"
  179. protected_lines: ["number_of_shards", "number_of_replicas"]
  180. - current_file: "logging.yml"
  181. new_file: "{{ tempdir }}/elasticsearch-logging.yml"
  182. - name: Set ES configmap
  183. oc_configmap:
  184. state: present
  185. name: "{{ elasticsearch_name }}"
  186. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  187. from_file:
  188. elasticsearch.yml: "{{ tempdir }}/elasticsearch.yml"
  189. logging.yml: "{{ tempdir }}/elasticsearch-logging.yml"
  190. register: es_config_creation
  191. notify: "restart elasticsearch"
  192. - when: openshift_logging_es5_techpreview | bool
  193. block:
  194. - template:
  195. src: "{{ __base_file_dir }}/log4j2.properties.j2"
  196. dest: "{{ tempdir }}/log4j2.properties"
  197. vars:
  198. root_logger: "{{ openshift_logging_es_log_appenders | list }}"
  199. changed_when: no
  200. - include_role:
  201. name: openshift_logging
  202. tasks_from: patch_configmap_files.yaml
  203. vars:
  204. configmap_name: "logging-elasticsearch"
  205. configmap_namespace: "logging"
  206. configmap_file_names:
  207. - current_file: "elasticsearch.yml"
  208. new_file: "{{ tempdir }}/elasticsearch.yml"
  209. - current_file: "log4j2.properties"
  210. new_file: "{{ tempdir }}/log4j2.properties"
  211. - name: Set ES configmap
  212. oc_configmap:
  213. state: present
  214. name: "{{ elasticsearch_name }}"
  215. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  216. from_file:
  217. elasticsearch.yml: "{{ tempdir }}/elasticsearch.yml"
  218. log4j2.properties: "{{ tempdir }}/log4j2.properties"
  219. register: es_config_creation
  220. notify: "restart elasticsearch"
  221. - when: es_config_creation.changed | bool
  222. block:
  223. - set_fact:
  224. _restart_logging_components: "{{ _restart_logging_components | default([]) + [es_component] | unique }}"
  225. - shell: >
  226. oc get dc -l component="{{ es_component }}" -n "{{ openshift_logging_elasticsearch_namespace }}" -o name | cut -d'/' -f2
  227. register: _es_dcs
  228. - set_fact:
  229. _restart_logging_nodes: "{{ _restart_logging_nodes | default([]) + [_es_dcs.stdout] | unique }}"
  230. when: _es_dcs.stdout != ""
  231. # secret
  232. - name: Set ES secret
  233. oc_secret:
  234. state: present
  235. name: "logging-elasticsearch"
  236. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  237. files:
  238. - name: key
  239. path: "{{ generated_certs_dir }}/logging-es.jks"
  240. - name: truststore
  241. path: "{{ generated_certs_dir }}/truststore.jks"
  242. - name: searchguard.key
  243. path: "{{ generated_certs_dir }}/elasticsearch.jks"
  244. - name: searchguard.truststore
  245. path: "{{ generated_certs_dir }}/truststore.jks"
  246. - name: admin-key
  247. path: "{{ generated_certs_dir }}/system.admin.key"
  248. - name: admin-cert
  249. path: "{{ generated_certs_dir }}/system.admin.crt"
  250. - name: admin-ca
  251. path: "{{ generated_certs_dir }}/ca.crt"
  252. - name: admin.jks
  253. path: "{{ generated_certs_dir }}/system.admin.jks"
  254. - name: passwd.yml
  255. path: "{{mktemp.stdout}}/passwd.yml"
  256. # services
  257. - name: Set logging-{{ es_component }}-cluster service
  258. oc_service:
  259. state: present
  260. name: "logging-{{ es_component }}-cluster"
  261. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  262. selector:
  263. component: "{{ es_component }}"
  264. provider: openshift
  265. labels:
  266. logging-infra: 'support'
  267. ports:
  268. - port: 9300
  269. - name: Set logging-{{ es_component }} service
  270. oc_service:
  271. state: present
  272. name: "logging-{{ es_component }}"
  273. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  274. selector:
  275. component: "{{ es_component }}"
  276. provider: openshift
  277. labels:
  278. logging-infra: 'support'
  279. ports:
  280. - port: 9200
  281. targetPort: "restapi"
  282. - name: Set logging-{{ es_component}}-prometheus service
  283. oc_service:
  284. state: present
  285. name: "logging-{{es_component}}-prometheus"
  286. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  287. labels:
  288. logging-infra: 'support'
  289. ports:
  290. - name: proxy
  291. port: 443
  292. targetPort: 4443
  293. selector:
  294. component: "{{ es_component }}"
  295. provider: openshift
  296. - oc_edit:
  297. kind: service
  298. name: "logging-{{es_component}}-prometheus"
  299. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  300. separator: '#'
  301. content:
  302. metadata#annotations#service.alpha.openshift.io/serving-cert-secret-name: "prometheus-tls"
  303. metadata#annotations#prometheus.io/scrape: "true"
  304. metadata#annotations#prometheus.io/scheme: "https"
  305. metadata#annotations#prometheus.io/path: "_prometheus/metrics"
  306. - name: Check to see if PVC already exists
  307. oc_obj:
  308. state: list
  309. kind: pvc
  310. name: "{{ openshift_logging_elasticsearch_pvc_name }}"
  311. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  312. register: logging_elasticsearch_pvc
  313. # logging_elasticsearch_pvc.results.results | length > 0 returns a false positive
  314. # so we check for the presence of 'stderr' to determine if the obj exists or not
  315. # the RC for existing and not existing is both 0
  316. - when:
  317. - logging_elasticsearch_pvc.results.stderr is defined
  318. - openshift_logging_elasticsearch_storage_type == "pvc"
  319. block:
  320. # storageclasses are used by default but if static then disable
  321. # storageclasses with the storageClassName set to "" in pvc.j2
  322. - name: Creating ES storage template - static
  323. template:
  324. src: "{{ __base_file_dir }}/pvc.j2"
  325. dest: "{{ tempdir }}/templates/logging-es-pvc.yml"
  326. vars:
  327. obj_name: "{{ openshift_logging_elasticsearch_pvc_name }}"
  328. size: "{{ (openshift_logging_elasticsearch_pvc_size | trim | length == 0) | ternary('10Gi', openshift_logging_elasticsearch_pvc_size) }}"
  329. access_modes: "{{ openshift_logging_elasticsearch_pvc_access_modes | list }}"
  330. pv_selector: "{{ openshift_logging_elasticsearch_pvc_pv_selector }}"
  331. storage_class_name: "{{ openshift_logging_elasticsearch_pvc_storage_class_name | default('', true) }}"
  332. when:
  333. - not openshift_logging_elasticsearch_pvc_dynamic | bool
  334. # Storageclasses are used by default if configured
  335. - name: Creating ES storage template - dynamic
  336. template:
  337. src: "{{ __base_file_dir }}/pvc.j2"
  338. dest: "{{ tempdir }}/templates/logging-es-pvc.yml"
  339. vars:
  340. obj_name: "{{ openshift_logging_elasticsearch_pvc_name }}"
  341. size: "{{ (openshift_logging_elasticsearch_pvc_size | trim | length == 0) | ternary('10Gi', openshift_logging_elasticsearch_pvc_size) }}"
  342. access_modes: "{{ openshift_logging_elasticsearch_pvc_access_modes | list }}"
  343. pv_selector: "{{ openshift_logging_elasticsearch_pvc_pv_selector }}"
  344. when:
  345. - openshift_logging_elasticsearch_pvc_dynamic | bool
  346. - name: Set ES storage
  347. oc_obj:
  348. state: present
  349. kind: pvc
  350. name: "{{ openshift_logging_elasticsearch_pvc_name }}"
  351. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  352. files:
  353. - "{{ tempdir }}/templates/logging-es-pvc.yml"
  354. delete_after: true
  355. - set_fact:
  356. es_deploy_name: "logging-{{ es_component }}-{{ openshift_logging_elasticsearch_deployment_type }}-{{ 8 | lib_utils_oo_random_word('abcdefghijklmnopqrstuvwxyz0123456789') }}"
  357. when: openshift_logging_elasticsearch_deployment_name == ""
  358. - set_fact:
  359. es_deploy_name: "{{ openshift_logging_elasticsearch_deployment_name }}"
  360. when: openshift_logging_elasticsearch_deployment_name != ""
  361. # DC
  362. - name: Set ES dc templates
  363. template:
  364. src: "{{ __base_file_dir }}/es.j2"
  365. dest: "{{ tempdir }}/templates/logging-es-dc.yml"
  366. vars:
  367. es_cluster_name: "{{ es_component }}"
  368. component: "{{ es_component }}"
  369. logging_component: elasticsearch
  370. deploy_name: "{{ es_deploy_name }}"
  371. image: "{{ openshift_logging_elasticsearch_image_prefix }}logging-elasticsearch:{{ openshift_logging_elasticsearch_image_version }}"
  372. proxy_image: "{{ openshift_logging_elasticsearch_proxy_image_prefix }}oauth-proxy:{{ openshift_logging_elasticsearch_proxy_image_version }}"
  373. es_cpu_limit: "{{ openshift_logging_elasticsearch_cpu_limit | default('') }}"
  374. es_cpu_request: "{{ openshift_logging_elasticsearch_cpu_request | min_cpu(openshift_logging_elasticsearch_cpu_limit | default(none)) }}"
  375. es_memory_limit: "{{ openshift_logging_elasticsearch_memory_limit }}"
  376. es_node_selector: "{{ openshift_logging_elasticsearch_nodeselector | default({}) }}"
  377. es_storage_groups: "{{ openshift_logging_elasticsearch_storage_group | default([]) }}"
  378. es_container_security_context: "{{ _es_containers.elasticsearch.securityContext if _es_containers is defined and 'elasticsearch' in _es_containers and 'securityContext' in _es_containers.elasticsearch else None }}"
  379. deploy_type: "{{ openshift_logging_elasticsearch_deployment_type }}"
  380. es_replicas: 1
  381. basic_auth_passwd: "{{ _logging_metrics_proxy_passwd | b64decode }}"
  382. es_number_of_shards: "{{ openshift_logging_es_number_of_shards | default(1) }}"
  383. es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas| default(0) }}"
  384. - name: Set ES dc
  385. oc_obj:
  386. state: present
  387. name: "{{ es_deploy_name }}"
  388. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  389. kind: dc
  390. files:
  391. - "{{ tempdir }}/templates/logging-es-dc.yml"
  392. delete_after: true
  393. register: es_dc_creation
  394. notify: "restart elasticsearch"
  395. - set_fact:
  396. _restart_logging_components: "{{ _restart_logging_components | default([]) + [es_component] | unique }}"
  397. _restart_logging_nodes: "{{ _restart_logging_nodes | default([]) + [es_deploy_name] | unique }}"
  398. when: es_dc_creation.changed | bool
  399. - name: Retrieving the cert to use when generating secrets for the {{ es_component }} component
  400. slurp:
  401. src: "{{ generated_certs_dir }}/{{ item.file }}"
  402. register: key_pairs
  403. with_items:
  404. - { name: "ca_file", file: "ca.crt" }
  405. - { name: "es_key", file: "system.logging.es.key" }
  406. - { name: "es_cert", file: "system.logging.es.crt" }
  407. when: openshift_logging_es_allow_external | bool
  408. - set_fact:
  409. es_key: "{{ lookup('file', openshift_logging_es_key) | b64encode }}"
  410. when:
  411. - openshift_logging_es_key | trim | length > 0
  412. - openshift_logging_es_allow_external | bool
  413. changed_when: false
  414. - set_fact:
  415. es_cert: "{{ lookup('file', openshift_logging_es_cert) | b64encode }}"
  416. when:
  417. - openshift_logging_es_cert | trim | length > 0
  418. - openshift_logging_es_allow_external | bool
  419. changed_when: false
  420. - set_fact:
  421. es_ca: "{{ lookup('file', openshift_logging_es_ca_ext) | b64encode }}"
  422. when:
  423. - openshift_logging_es_ca_ext | trim | length > 0
  424. - openshift_logging_es_allow_external | bool
  425. changed_when: false
  426. - set_fact:
  427. es_ca: "{{ key_pairs | entry_from_named_pair('ca_file') }}"
  428. when:
  429. - es_ca is not defined
  430. - openshift_logging_es_allow_external | bool
  431. changed_when: false
  432. - name: Generating Elasticsearch {{ es_component }} route template
  433. template:
  434. src: "{{ __base_file_dir }}/route_reencrypt.j2"
  435. dest: "{{mktemp.stdout}}/templates/logging-{{ es_component }}-route.yaml"
  436. vars:
  437. obj_name: "logging-{{ es_component }}"
  438. route_host: "{{ openshift_logging_es_hostname }}"
  439. service_name: "logging-{{ es_component }}"
  440. tls_key: "{{ es_key | default('') | b64decode }}"
  441. tls_cert: "{{ es_cert | default('') | b64decode }}"
  442. tls_ca_cert: "{{ es_ca | b64decode }}"
  443. tls_dest_ca_cert: "{{ key_pairs | entry_from_named_pair('ca_file') | b64decode }}"
  444. edge_term_policy: "{{ openshift_logging_es_edge_term_policy | default('') }}"
  445. labels:
  446. component: support
  447. logging-infra: support
  448. provider: openshift
  449. changed_when: no
  450. when: openshift_logging_es_allow_external | bool
  451. # This currently has an issue if the host name changes
  452. - name: Setting Elasticsearch {{ es_component }} route
  453. oc_obj:
  454. state: present
  455. name: "logging-{{ es_component }}"
  456. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  457. kind: route
  458. files:
  459. - "{{ tempdir }}/templates/logging-{{ es_component }}-route.yaml"
  460. when: openshift_logging_es_allow_external | bool
  461. ## Placeholder for migration when necessary ##
  462. - name: Delete temp directory
  463. file:
  464. name: "{{ tempdir }}"
  465. state: absent
  466. changed_when: False