|
@@ -64,7 +64,6 @@
|
|
# we want to make sure we have all the necessary components here
|
|
# we want to make sure we have all the necessary components here
|
|
|
|
|
|
# service account
|
|
# service account
|
|
-
|
|
|
|
- name: Create ES service account
|
|
- name: Create ES service account
|
|
oc_serviceaccount:
|
|
oc_serviceaccount:
|
|
state: present
|
|
state: present
|
|
@@ -82,19 +81,14 @@
|
|
- openshift_logging_image_pull_secret == ''
|
|
- openshift_logging_image_pull_secret == ''
|
|
|
|
|
|
# rolebinding reader
|
|
# rolebinding reader
|
|
-- copy:
|
|
|
|
- src: rolebinding-reader.yml
|
|
|
|
- dest: "{{ tempdir }}/rolebinding-reader.yml"
|
|
|
|
-
|
|
|
|
- name: Create rolebinding-reader role
|
|
- name: Create rolebinding-reader role
|
|
- oc_obj:
|
|
|
|
|
|
+ oc_clusterrole:
|
|
state: present
|
|
state: present
|
|
- name: "rolebinding-reader"
|
|
|
|
- kind: clusterrole
|
|
|
|
- namespace: "{{ openshift_logging_elasticsearch_namespace }}"
|
|
|
|
- files:
|
|
|
|
- - "{{ tempdir }}/rolebinding-reader.yml"
|
|
|
|
- delete_after: true
|
|
|
|
|
|
+ name: rolebinding-reader
|
|
|
|
+ rules:
|
|
|
|
+ - apiGroups: [""]
|
|
|
|
+ resources: ["clusterrolebindings"]
|
|
|
|
+ verbs: ["get"]
|
|
|
|
|
|
# SA roles
|
|
# SA roles
|
|
- name: Set rolebinding-reader permissions for ES
|
|
- name: Set rolebinding-reader permissions for ES
|
|
@@ -114,7 +108,7 @@
|
|
|
|
|
|
# logging-metrics-reader role
|
|
# logging-metrics-reader role
|
|
- template:
|
|
- template:
|
|
- src: logging-metrics-role.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/logging-metrics-role.j2"
|
|
dest: "{{mktemp.stdout}}/templates/logging-metrics-role.yml"
|
|
dest: "{{mktemp.stdout}}/templates/logging-metrics-role.yml"
|
|
vars:
|
|
vars:
|
|
namespace: "{{ openshift_logging_elasticsearch_namespace }}"
|
|
namespace: "{{ openshift_logging_elasticsearch_namespace }}"
|
|
@@ -150,7 +144,7 @@
|
|
# View role and binding
|
|
# View role and binding
|
|
- name: Generate logging-elasticsearch-view-role
|
|
- name: Generate logging-elasticsearch-view-role
|
|
template:
|
|
template:
|
|
- src: rolebinding.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/rolebinding.j2"
|
|
dest: "{{mktemp.stdout}}/logging-elasticsearch-view-role.yaml"
|
|
dest: "{{mktemp.stdout}}/logging-elasticsearch-view-role.yaml"
|
|
vars:
|
|
vars:
|
|
obj_name: logging-elasticsearch-view-role
|
|
obj_name: logging-elasticsearch-view-role
|
|
@@ -183,51 +177,80 @@
|
|
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(', ') }}"
|
|
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(', ') }}"
|
|
|
|
|
|
- template:
|
|
- template:
|
|
- src: elasticsearch-logging.yml.j2
|
|
|
|
- dest: "{{ tempdir }}/elasticsearch-logging.yml"
|
|
|
|
- vars:
|
|
|
|
- root_logger: "{{openshift_logging_es_log_appenders | join(', ')}}"
|
|
|
|
- when: es_logging_contents is undefined
|
|
|
|
- changed_when: no
|
|
|
|
-
|
|
|
|
-- template:
|
|
|
|
- src: elasticsearch.yml.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/elasticsearch.yml.j2"
|
|
dest: "{{ tempdir }}/elasticsearch.yml"
|
|
dest: "{{ tempdir }}/elasticsearch.yml"
|
|
vars:
|
|
vars:
|
|
allow_cluster_reader: "{{ openshift_logging_elasticsearch_ops_allow_cluster_reader | lower | default('false') }}"
|
|
allow_cluster_reader: "{{ openshift_logging_elasticsearch_ops_allow_cluster_reader | lower | default('false') }}"
|
|
es_number_of_shards: "{{ openshift_logging_es_number_of_shards | default(1) }}"
|
|
es_number_of_shards: "{{ openshift_logging_es_number_of_shards | default(1) }}"
|
|
es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas| default(0) }}"
|
|
es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas| default(0) }}"
|
|
es_kibana_index_mode: "{{ openshift_logging_elasticsearch_kibana_index_mode | default('unique') }}"
|
|
es_kibana_index_mode: "{{ openshift_logging_elasticsearch_kibana_index_mode | default('unique') }}"
|
|
-
|
|
|
|
- when: es_config_contents is undefined
|
|
|
|
changed_when: no
|
|
changed_when: no
|
|
|
|
|
|
# create diff between current configmap files and our current files
|
|
# create diff between current configmap files and our current files
|
|
-# NOTE: include_role must be used instead of import_role because
|
|
|
|
-# this task file is looped over from another role.
|
|
|
|
-- include_role:
|
|
|
|
- name: openshift_logging
|
|
|
|
- tasks_from: patch_configmap_files.yaml
|
|
|
|
- vars:
|
|
|
|
- configmap_name: "logging-elasticsearch"
|
|
|
|
- configmap_namespace: "logging"
|
|
|
|
- configmap_file_names:
|
|
|
|
- - current_file: "elasticsearch.yml"
|
|
|
|
- new_file: "{{ tempdir }}/elasticsearch.yml"
|
|
|
|
- protected_lines: ["number_of_shards", "number_of_replicas"]
|
|
|
|
- - current_file: "logging.yml"
|
|
|
|
- new_file: "{{ tempdir }}/elasticsearch-logging.yml"
|
|
|
|
-
|
|
|
|
-- name: Set ES configmap
|
|
|
|
- oc_configmap:
|
|
|
|
- state: present
|
|
|
|
- name: "{{ elasticsearch_name }}"
|
|
|
|
- namespace: "{{ openshift_logging_elasticsearch_namespace }}"
|
|
|
|
- from_file:
|
|
|
|
- elasticsearch.yml: "{{ tempdir }}/elasticsearch.yml"
|
|
|
|
- logging.yml: "{{ tempdir }}/elasticsearch-logging.yml"
|
|
|
|
- register: es_config_creation
|
|
|
|
- notify: "restart elasticsearch"
|
|
|
|
|
|
+- when: not openshift_logging_es5_techpreview
|
|
|
|
+ block:
|
|
|
|
+ - template:
|
|
|
|
+ src: "{{ __base_file_dir }}/elasticsearch-logging.yml.j2"
|
|
|
|
+ dest: "{{ tempdir }}/elasticsearch-logging.yml"
|
|
|
|
+ vars:
|
|
|
|
+ root_logger: "{{openshift_logging_es_log_appenders | join(', ')}}"
|
|
|
|
+ changed_when: no
|
|
|
|
+
|
|
|
|
+ - include_role:
|
|
|
|
+ name: openshift_logging
|
|
|
|
+ tasks_from: patch_configmap_files.yaml
|
|
|
|
+ vars:
|
|
|
|
+ configmap_name: "logging-elasticsearch"
|
|
|
|
+ configmap_namespace: "logging"
|
|
|
|
+ configmap_file_names:
|
|
|
|
+ - current_file: "elasticsearch.yml"
|
|
|
|
+ new_file: "{{ tempdir }}/elasticsearch.yml"
|
|
|
|
+ protected_lines: ["number_of_shards", "number_of_replicas"]
|
|
|
|
+ - current_file: "logging.yml"
|
|
|
|
+ new_file: "{{ tempdir }}/elasticsearch-logging.yml"
|
|
|
|
+
|
|
|
|
+ - name: Set ES configmap
|
|
|
|
+ oc_configmap:
|
|
|
|
+ state: present
|
|
|
|
+ name: "{{ elasticsearch_name }}"
|
|
|
|
+ namespace: "{{ openshift_logging_elasticsearch_namespace }}"
|
|
|
|
+ from_file:
|
|
|
|
+ elasticsearch.yml: "{{ tempdir }}/elasticsearch.yml"
|
|
|
|
+ logging.yml: "{{ tempdir }}/elasticsearch-logging.yml"
|
|
|
|
+ register: es_config_creation
|
|
|
|
+ notify: "restart elasticsearch"
|
|
|
|
+
|
|
|
|
+- when: openshift_logging_es5_techpreview | bool
|
|
|
|
+ block:
|
|
|
|
+ - template:
|
|
|
|
+ src: "{{ __base_file_dir }}/log4j2.properties.j2"
|
|
|
|
+ dest: "{{ tempdir }}/log4j2.properties"
|
|
|
|
+ vars:
|
|
|
|
+ root_logger: "{{ openshift_logging_es_log_appenders | list }}"
|
|
|
|
+ changed_when: no
|
|
|
|
+
|
|
|
|
+ - include_role:
|
|
|
|
+ name: openshift_logging
|
|
|
|
+ tasks_from: patch_configmap_files.yaml
|
|
|
|
+ vars:
|
|
|
|
+ configmap_name: "logging-elasticsearch"
|
|
|
|
+ configmap_namespace: "logging"
|
|
|
|
+ configmap_file_names:
|
|
|
|
+ - current_file: "elasticsearch.yml"
|
|
|
|
+ new_file: "{{ tempdir }}/elasticsearch.yml"
|
|
|
|
+ - current_file: "log4j2.properties"
|
|
|
|
+ new_file: "{{ tempdir }}/log4j2.properties"
|
|
|
|
+
|
|
|
|
+ - name: Set ES configmap
|
|
|
|
+ oc_configmap:
|
|
|
|
+ state: present
|
|
|
|
+ name: "{{ elasticsearch_name }}"
|
|
|
|
+ namespace: "{{ openshift_logging_elasticsearch_namespace }}"
|
|
|
|
+ from_file:
|
|
|
|
+ elasticsearch.yml: "{{ tempdir }}/elasticsearch.yml"
|
|
|
|
+ log4j2.properties: "{{ tempdir }}/log4j2.properties"
|
|
|
|
+ register: es_config_creation
|
|
|
|
+ notify: "restart elasticsearch"
|
|
|
|
|
|
- when: es_config_creation.changed | bool
|
|
- when: es_config_creation.changed | bool
|
|
block:
|
|
block:
|
|
@@ -341,7 +364,7 @@
|
|
# storageclasses with the storageClassName set to "" in pvc.j2
|
|
# storageclasses with the storageClassName set to "" in pvc.j2
|
|
- name: Creating ES storage template - static
|
|
- name: Creating ES storage template - static
|
|
template:
|
|
template:
|
|
- src: pvc.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/pvc.j2"
|
|
dest: "{{ tempdir }}/templates/logging-es-pvc.yml"
|
|
dest: "{{ tempdir }}/templates/logging-es-pvc.yml"
|
|
vars:
|
|
vars:
|
|
obj_name: "{{ openshift_logging_elasticsearch_pvc_name }}"
|
|
obj_name: "{{ openshift_logging_elasticsearch_pvc_name }}"
|
|
@@ -355,7 +378,7 @@
|
|
# Storageclasses are used by default if configured
|
|
# Storageclasses are used by default if configured
|
|
- name: Creating ES storage template - dynamic
|
|
- name: Creating ES storage template - dynamic
|
|
template:
|
|
template:
|
|
- src: pvc.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/pvc.j2"
|
|
dest: "{{ tempdir }}/templates/logging-es-pvc.yml"
|
|
dest: "{{ tempdir }}/templates/logging-es-pvc.yml"
|
|
vars:
|
|
vars:
|
|
obj_name: "{{ openshift_logging_elasticsearch_pvc_name }}"
|
|
obj_name: "{{ openshift_logging_elasticsearch_pvc_name }}"
|
|
@@ -386,7 +409,7 @@
|
|
# DC
|
|
# DC
|
|
- name: Set ES dc templates
|
|
- name: Set ES dc templates
|
|
template:
|
|
template:
|
|
- src: es.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/es.j2"
|
|
dest: "{{ tempdir }}/templates/logging-es-dc.yml"
|
|
dest: "{{ tempdir }}/templates/logging-es-dc.yml"
|
|
vars:
|
|
vars:
|
|
es_cluster_name: "{{ es_component }}"
|
|
es_cluster_name: "{{ es_component }}"
|
|
@@ -404,6 +427,8 @@
|
|
deploy_type: "{{ openshift_logging_elasticsearch_deployment_type }}"
|
|
deploy_type: "{{ openshift_logging_elasticsearch_deployment_type }}"
|
|
es_replicas: 1
|
|
es_replicas: 1
|
|
basic_auth_passwd: "{{ _logging_metrics_proxy_passwd | b64decode }}"
|
|
basic_auth_passwd: "{{ _logging_metrics_proxy_passwd | b64decode }}"
|
|
|
|
+ es_number_of_shards: "{{ openshift_logging_es_number_of_shards | default(1) }}"
|
|
|
|
+ es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas| default(0) }}"
|
|
|
|
|
|
- name: Set ES dc
|
|
- name: Set ES dc
|
|
oc_obj:
|
|
oc_obj:
|
|
@@ -462,7 +487,7 @@
|
|
|
|
|
|
- name: Generating Elasticsearch {{ es_component }} route template
|
|
- name: Generating Elasticsearch {{ es_component }} route template
|
|
template:
|
|
template:
|
|
- src: route_reencrypt.j2
|
|
|
|
|
|
+ src: "{{ __base_file_dir }}/route_reencrypt.j2"
|
|
dest: "{{mktemp.stdout}}/templates/logging-{{ es_component }}-route.yaml"
|
|
dest: "{{mktemp.stdout}}/templates/logging-{{ es_component }}-route.yaml"
|
|
vars:
|
|
vars:
|
|
obj_name: "logging-{{ es_component }}"
|
|
obj_name: "logging-{{ es_component }}"
|