install_logging.yaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. ---
  2. - name: Gather OpenShift Logging Facts
  3. openshift_logging_facts:
  4. oc_bin: "{{openshift.common.client_binary}}"
  5. openshift_logging_namespace: "{{openshift_logging_namespace}}"
  6. - name: Set logging project
  7. oc_project:
  8. state: present
  9. name: "{{ openshift_logging_namespace }}"
  10. node_selector: "{{ openshift_logging_nodeselector | default(null) }}"
  11. - name: Labelling logging project
  12. oc_label:
  13. state: present
  14. kind: namespace
  15. name: "{{ openshift_logging_namespace }}"
  16. labels:
  17. - key: "{{ item.key }}"
  18. value: "{{ item.value }}"
  19. with_dict: "{{ openshift_logging_labels | default({}) }}"
  20. when:
  21. - openshift_logging_labels is defined
  22. - openshift_logging_labels is dict
  23. - name: Labelling logging project
  24. oc_label:
  25. state: present
  26. kind: namespace
  27. name: "{{ openshift_logging_namespace }}"
  28. labels:
  29. - key: "{{ openshift_logging_label_key }}"
  30. value: "{{ openshift_logging_label_value }}"
  31. when:
  32. - openshift_logging_label_key is defined
  33. - openshift_logging_label_key != ""
  34. - openshift_logging_label_value is defined
  35. - name: Create logging cert directory
  36. file:
  37. path: "{{ openshift.common.config_base }}/logging"
  38. state: directory
  39. mode: 0755
  40. changed_when: False
  41. check_mode: no
  42. - include: generate_certs.yaml
  43. vars:
  44. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  45. ## Elasticsearch
  46. # TODO: add more vars
  47. # We don't allow scaling down of ES nodes currently
  48. - include_role:
  49. name: openshift_logging_elasticsearch
  50. vars:
  51. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  52. openshift_logging_elasticsearch_deployment_name: "{{ item.0 }}"
  53. openshift_logging_elasticsearch_pvc_name: "{{ item.1 }}"
  54. openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_cluster_size | int }}"
  55. #openshift_logging_elasticsearch_storage_type: "{{ }}"
  56. openshift_logging_elasticsearch_pvc_size: "{{ openshift_logging_es_pvc_size }}"
  57. openshift_logging_elasticsearch_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic }}"
  58. openshift_logging_elasticsearch_pvc_pv_selector: "{{ openshift_logging_es_pv_selector }}"
  59. with_together:
  60. - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs }}"
  61. - "{{ openshift_logging_facts.elasticsearch.pvcs }}"
  62. # Create any new DC that may be required
  63. - include_role:
  64. name: openshift_logging_elasticsearch
  65. vars:
  66. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  67. openshift_logging_elasticsearch_pvc_name: "{{ openshift_logging_es_pvc_prefix }}-{{ item | int + openshift_logging_facts.elasticsearch.deploymentconfigs | count }}"
  68. openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_cluster_size | int }}"
  69. with_sequence: count={{ openshift_logging_es_cluster_size | int - openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count }}
  70. # TODO: add more vars
  71. - include_role:
  72. name: openshift_logging_elasticsearch
  73. vars:
  74. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  75. openshift_logging_elasticsearch_deployment_name: "{{ item.0 }}"
  76. openshift_logging_elasticsearch_pvc_name: "{{ item.1 }}"
  77. openshift_logging_elasticsearch_ops_deployment: true
  78. openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_ops_cluster_size | int }}"
  79. #openshift_logging_elasticsearch_storage_type: "{{ }}"
  80. openshift_logging_elasticsearch_pvc_size: "{{ openshift_logging_es_pvc_size }}"
  81. openshift_logging_elasticsearch_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic }}"
  82. openshift_logging_elasticsearch_pvc_pv_selector: "{{ openshift_logging_es_pv_selector }}"
  83. with_together:
  84. - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs }}"
  85. - "{{ openshift_logging_facts.elasticsearch_ops.pvcs }}"
  86. when:
  87. - openshift_logging_use_ops | bool
  88. # Create any new DC that may be required
  89. - include_role:
  90. name: openshift_logging_elasticsearch
  91. vars:
  92. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  93. openshift_logging_elasticsearch_pvc_name: "{{ openshift_logging_es_pvc_prefix }}-{{ item | int + openshift_logging_facts.elasticsearch_ops.deploymentconfigs | count }}"
  94. openshift_logging_elasticsearch_ops_deployment: true
  95. openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_ops_cluster_size | int }}"
  96. with_sequence: count={{ ( ( openshift_logging_es_ops_cluster_size | int ) - ( openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count ) ) }}
  97. when:
  98. - openshift_logging_use_ops | bool
  99. ## Kibana
  100. - include_role:
  101. name: openshift_logging_kibana
  102. vars:
  103. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  104. openshift_logging_kibana_namespace: "{{ openshift_logging_namespace }}"
  105. openshift_logging_kibana_master_url: "{{ openshift_logging_master_url }}"
  106. openshift_logging_kibana_master_public_url: "{{ openshift_logging_master_public_url }}"
  107. openshift_logging_kibana_image_prefix: "{{ openshift_logging_image_prefix }}"
  108. openshift_logging_kibana_image_version: "{{ openshift_logging_image_version }}"
  109. openshift_logging_kibana_replicas: "{{ openshift_logging_kibana_replica_count }}"
  110. openshift_logging_kibana_es_host: "{{ openshift_logging_es_host }}"
  111. openshift_logging_kibana_es_port: "{{ openshift_logging_es_port }}"
  112. openshift_logging_kibana_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
  113. - include_role:
  114. name: openshift_logging_kibana
  115. vars:
  116. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  117. openshift_logging_kibana_ops_deployment: true
  118. openshift_logging_kibana_namespace: "{{ openshift_logging_namespace }}"
  119. openshift_logging_kibana_master_url: "{{ openshift_logging_master_url }}"
  120. openshift_logging_kibana_master_public_url: "{{ openshift_logging_master_public_url }}"
  121. openshift_logging_kibana_image_prefix: "{{ openshift_logging_image_prefix }}"
  122. openshift_logging_kibana_image_version: "{{ openshift_logging_image_version }}"
  123. openshift_logging_kibana_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
  124. openshift_logging_kibana_es_host: "{{ openshift_logging_es_ops_host }}"
  125. openshift_logging_kibana_es_port: "{{ openshift_logging_es_ops_port }}"
  126. openshift_logging_kibana_nodeselector: "{{ openshift_logging_kibana_ops_nodeselector }}"
  127. openshift_logging_kibana_cpu_limit: "{{ openshift_logging_kibana_ops_cpu_limit }}"
  128. openshift_logging_kibana_memory_limit: "{{ openshift_logging_kibana_ops_memory_limit }}"
  129. openshift_logging_kibana_hostname: "{{ openshift_logging_kibana_ops_hostname }}"
  130. openshift_logging_kibana_replicas: "{{ openshift_logging_kibana_ops_replica_count }}"
  131. openshift_logging_kibana_proxy_debug: "{{ openshift_logging_kibana_ops_proxy_debug }}"
  132. openshift_logging_kibana_proxy_cpu_limit: "{{ openshift_logging_kibana_ops_proxy_cpu_limit }}"
  133. openshift_logging_kibana_proxy_memory_limit: "{{ openshift_logging_kibana_ops_proxy_memory_limit }}"
  134. openshift_logging_kibana_cert: "{{ openshift_logging_kibana_ops_cert }}"
  135. openshift_logging_kibana_key: "{{ openshift_logging_kibana_ops_key }}"
  136. openshift_logging_kibana_ca: "{{ openshift_logging_kibana_ops_ca}}"
  137. when:
  138. - openshift_logging_use_ops | bool
  139. ## Curator
  140. - include_role:
  141. name: openshift_logging_curator
  142. vars:
  143. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  144. openshift_logging_curator_namespace: "{{ openshift_logging_namespace }}"
  145. openshift_logging_curator_master_url: "{{ openshift_logging_master_url }}"
  146. openshift_logging_curator_image_prefix: "{{ openshift_logging_image_prefix }}"
  147. openshift_logging_curator_image_version: "{{ openshift_logging_image_version }}"
  148. openshift_logging_curator_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
  149. - include_role:
  150. name: openshift_logging_curator
  151. vars:
  152. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  153. openshift_logging_curator_ops_deployment: true
  154. openshift_logging_curator_namespace: "{{ openshift_logging_namespace }}"
  155. openshift_logging_curator_master_url: "{{ openshift_logging_master_url }}"
  156. openshift_logging_curator_image_prefix: "{{ openshift_logging_image_prefix }}"
  157. openshift_logging_curator_image_version: "{{ openshift_logging_image_version }}"
  158. openshift_logging_curator_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
  159. openshift_logging_curator_cpu_limit: "{{ openshift_logging_curator_ops_cpu_limit }}"
  160. openshift_logging_curator_memory_limit: "{{ openshift_logging_curator_ops_memory_limit }}"
  161. openshift_logging_curator_nodeselector: "{{ openshift_logging_curator_ops_nodeselector }}"
  162. when:
  163. - openshift_logging_use_ops | bool
  164. ## Mux
  165. - include_role:
  166. name: openshift_logging_mux
  167. vars:
  168. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  169. openshift_logging_mux_ops_host: "{{ ( openshift_logging_use_ops | bool ) | ternary('logging-es-ops', 'logging-es') }}"
  170. openshift_logging_mux_namespace: "{{ openshift_logging_namespace }}"
  171. openshift_logging_mux_master_url: "{{ openshift_logging_master_url }}"
  172. openshift_logging_mux_image_prefix: "{{ openshift_logging_image_prefix }}"
  173. openshift_logging_mux_image_version: "{{ openshift_logging_image_version }}"
  174. openshift_logging_mux_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
  175. when:
  176. - openshift_logging_use_mux | bool
  177. ## Fluentd
  178. - include_role:
  179. name: openshift_logging_fluentd
  180. vars:
  181. generated_certs_dir: "{{openshift.common.config_base}}/logging"
  182. openshift_logging_fluentd_ops_host: "{{ ( openshift_logging_use_ops | bool ) | ternary('logging-es-ops', 'logging-es') }}"
  183. openshift_logging_fluentd_use_journal: "{{ openshift.docker.options | search('journald') }}"
  184. openshift_logging_fluentd_image_prefix: "{{ openshift_logging_image_prefix }}"
  185. openshift_logging_fluentd_image_version: "{{ openshift_logging_image_version }}"
  186. openshift_logging_fluentd_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
  187. openshift_logging_fluentd_master_url: "{{ openshift_logging_master_url }}"
  188. openshift_logging_fluentd_namespace: "{{ openshift_logging_namespace }}"
  189. - include: update_master_config.yaml