|
@@ -5,60 +5,47 @@
|
|
|
- set_fact: openshift_logging_es_pvc_prefix="logging-es"
|
|
|
when: "not openshift_logging_es_pvc_prefix or openshift_logging_es_pvc_prefix == ''"
|
|
|
|
|
|
-- set_fact: es_pvc_pool={{[]}}
|
|
|
-
|
|
|
-- set_fact: openshift_logging_es_pvc_prefix="{{ openshift_logging_es_pvc_prefix | default('logging-es') }}"
|
|
|
-
|
|
|
-- name: Generate PersistentVolumeClaims
|
|
|
- include: "{{ role_path}}/tasks/generate_pvcs.yaml"
|
|
|
+### evaluate if the PVC attached to the dc currently matches the provided vars
|
|
|
+## if it does then we reuse that pvc in the DC
|
|
|
+- include: set_es_storage.yaml
|
|
|
vars:
|
|
|
- es_pv_selector: "{{openshift_logging_es_pv_selector}}"
|
|
|
- es_pvc_dynamic: "{{openshift_logging_es_pvc_dynamic | bool}}"
|
|
|
- es_pvc_names: "{{openshift_logging_facts.elasticsearch.pvcs.keys()}}"
|
|
|
- es_pvc_prefix: "{{openshift_logging_es_pvc_prefix}}"
|
|
|
- es_pvc_size: "{{openshift_logging_es_pvc_size}}"
|
|
|
- es_dc_names: "{{openshift_logging_facts.elasticsearch.deploymentconfigs.keys()}}"
|
|
|
- es_cluster_size: "{{openshift_logging_es_cluster_size}}"
|
|
|
- es_access_modes: "{{ openshift_logging_storage_access_modes }}"
|
|
|
-
|
|
|
-# we should initialize the es_dc_pool with the current keys
|
|
|
-- name: Init pool of DeploymentConfig names for Elasticsearch
|
|
|
- set_fact: es_dc_pool={{ es_dc_pool | default([]) + [deploy_name] }}
|
|
|
- with_items: "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() }}"
|
|
|
+ es_component: es
|
|
|
+ es_name: "{{ deployment.0 }}"
|
|
|
+ es_spec: "{{ deployment.1 }}"
|
|
|
+ es_node_selector: "{{ openshift_logging_es_nodeselector | default({}) }}"
|
|
|
+ es_pvc_names: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() }}"
|
|
|
+ es_pvc_size: "{{ openshift_logging_es_pvc_size }}"
|
|
|
+ es_pvc_prefix: "{{ openshift_logging_es_pvc_prefix }}"
|
|
|
+ es_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic | bool }}"
|
|
|
+ es_pv_selector: "{{ openshift_logging_es_pv_selector }}"
|
|
|
+ es_cpu_limit: "{{ openshift_logging_es_cpu_limit }}"
|
|
|
+ es_memory_limit: "{{ openshift_logging_es_memory_limit }}"
|
|
|
+ es_number_of_shards: "{{ openshift_logging_es_number_of_shards }}"
|
|
|
+ es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas }}"
|
|
|
+ with_together:
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() }}"
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.values() }}"
|
|
|
loop_control:
|
|
|
- loop_var: deploy_name
|
|
|
+ loop_var: deployment
|
|
|
+## if it does not then we should create one that does and attach it
|
|
|
|
|
|
-# This should be used to generate new DC names if necessary
|
|
|
-- name: Create new DeploymentConfig names for Elasticsearch
|
|
|
- set_fact: es_dc_pool={{es_dc_pool|default([]) + [deploy_name]}}
|
|
|
+## create new dc/pvc is needed
|
|
|
+- include: set_es_storage.yaml
|
|
|
vars:
|
|
|
- component: es
|
|
|
- es_cluster_name: "{{component}}"
|
|
|
- deploy_name_prefix: "logging-{{component}}"
|
|
|
- deploy_name: "{{deploy_name_prefix}}-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"
|
|
|
- with_sequence: count={{ openshift_logging_es_cluster_size | int - openshift_logging_current_es_size | int }}
|
|
|
- check_mode: no
|
|
|
-
|
|
|
-- name: Generate Elasticsearch DeploymentConfig
|
|
|
- template: src=es.j2 dest={{mktemp.stdout}}/templates/logging-{{deploy_name}}-dc.yaml
|
|
|
- vars:
|
|
|
- component: es
|
|
|
- logging_component: elasticsearch
|
|
|
- deploy_name_prefix: "logging-{{component}}"
|
|
|
- image: "{{openshift_logging_image_prefix}}logging-elasticsearch:{{openshift_logging_image_version}}"
|
|
|
- es_cluster_name: "{{component}}"
|
|
|
- es_cpu_limit: "{{openshift_logging_es_cpu_limit }}"
|
|
|
- es_memory_limit: "{{openshift_logging_es_memory_limit}}"
|
|
|
- pvc_claim: "{{(es_pvc_pool | length > item.0) | ternary(es_pvc_pool[item.0], None)}}"
|
|
|
- deploy_name: "{{item.1}}"
|
|
|
- es_node_selector: "{{openshift_logging_es_nodeselector | default({}) }}"
|
|
|
- es_storage: "{{openshift_logging_facts|es_storage(deploy_name, pvc_claim)}}"
|
|
|
+ es_component: es
|
|
|
+ es_name: "logging-es-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"
|
|
|
+ es_spec: "{}"
|
|
|
+ es_node_selector: "{{ openshift_logging_es_nodeselector | default({}) }}"
|
|
|
+ es_pvc_names: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() }}"
|
|
|
+ es_pvc_size: "{{ openshift_logging_es_pvc_size }}"
|
|
|
+ es_pvc_prefix: "{{ openshift_logging_es_pvc_prefix }}"
|
|
|
+ es_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic | bool }}"
|
|
|
+ es_pv_selector: "{{ openshift_logging_es_pv_selector }}"
|
|
|
+ es_cpu_limit: "{{ openshift_logging_es_cpu_limit }}"
|
|
|
+ es_memory_limit: "{{ openshift_logging_es_memory_limit }}"
|
|
|
es_number_of_shards: "{{ openshift_logging_es_number_of_shards }}"
|
|
|
es_number_of_replicas: "{{ openshift_logging_es_number_of_replicas }}"
|
|
|
- with_indexed_items:
|
|
|
- - "{{ es_dc_pool }}"
|
|
|
- check_mode: no
|
|
|
- changed_when: no
|
|
|
+ with_sequence: count={{ openshift_logging_es_cluster_size | int - openshift_logging_facts.elasticsearch.deploymentconfigs | count }}
|
|
|
|
|
|
# --------- Tasks for Operation clusters ---------
|
|
|
|
|
@@ -73,74 +60,53 @@
|
|
|
es_dcs: "{{openshift_logging_facts.elasticsearch_ops.deploymentconfigs}}"
|
|
|
cluster_size: "{{openshift_logging_es_ops_cluster_size|int}}"
|
|
|
when:
|
|
|
- - openshift_logging_use_ops | bool
|
|
|
- - "{{es_dcs | length - openshift_logging_es_ops_cluster_size|int | abs > 1}}"
|
|
|
+ - openshift_logging_use_ops | bool
|
|
|
+ - "{{es_dcs | length - openshift_logging_es_ops_cluster_size|int | abs > 1}}"
|
|
|
check_mode: no
|
|
|
|
|
|
- set_fact: openshift_logging_es_ops_pvc_prefix="logging-es-ops"
|
|
|
when: "not openshift_logging_es_ops_pvc_prefix or openshift_logging_es_ops_pvc_prefix == ''"
|
|
|
|
|
|
-- set_fact: es_pvc_pool={{[]}}
|
|
|
-
|
|
|
-- name: Generate PersistentVolumeClaims for Ops
|
|
|
- include: "{{ role_path}}/tasks/generate_pvcs.yaml"
|
|
|
+- include: set_es_storage.yaml
|
|
|
vars:
|
|
|
- es_pvc_names: "{{openshift_logging_facts.elasticsearch_ops.pvcs.keys()}}"
|
|
|
- es_dc_names: "{{openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys()}}"
|
|
|
- es_pvc_size: "{{openshift_logging_es_ops_pvc_size}}"
|
|
|
- es_pvc_prefix: "{{openshift_logging_es_ops_pvc_prefix}}"
|
|
|
- es_cluster_size: "{{openshift_logging_es_ops_cluster_size|int}}"
|
|
|
- es_pvc_dynamic: "{{openshift_logging_es_ops_pvc_dynamic | bool}}"
|
|
|
- es_pv_selector: "{{openshift_logging_es_ops_pv_selector}}"
|
|
|
- es_access_modes: "{{ openshift_logging_storage_access_modes }}"
|
|
|
- when:
|
|
|
- - openshift_logging_use_ops | bool
|
|
|
- check_mode: no
|
|
|
-
|
|
|
-- name: Init pool of DeploymentConfig names for Elasticsearch Ops
|
|
|
- set_fact: es_ops_dc_pool={{ es_ops_dc_pool | default([]) + [deploy_name] }}
|
|
|
- with_items: "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() }}"
|
|
|
+ es_component: es-ops
|
|
|
+ es_name: "{{ deployment.0 }}"
|
|
|
+ es_spec: "{{ deployment.1 }}"
|
|
|
+ es_node_selector: "{{ openshift_logging_es_ops_nodeselector | default({}) }}"
|
|
|
+ es_pvc_names: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() }}"
|
|
|
+ es_pvc_size: "{{ openshift_logging_es_ops_pvc_size }}"
|
|
|
+ es_pvc_prefix: "{{ openshift_logging_es_ops_pvc_prefix }}"
|
|
|
+ es_pvc_dynamic: "{{ openshift_logging_es_ops_pvc_dynamic | bool }}"
|
|
|
+ es_pv_selector: "{{ openshift_logging_es_ops_pv_selector }}"
|
|
|
+ es_cpu_limit: "{{ openshift_logging_es_ops_cpu_limit }}"
|
|
|
+ es_memory_limit: "{{ openshift_logging_es_ops_memory_limit }}"
|
|
|
+ es_number_of_shards: "{{ openshift_logging_es_ops_number_of_shards }}"
|
|
|
+ es_number_of_replicas: "{{ openshift_logging_es_ops_number_of_replicas }}"
|
|
|
+ with_together:
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() }}"
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.values() }}"
|
|
|
loop_control:
|
|
|
- loop_var: deploy_name
|
|
|
- when:
|
|
|
- - openshift_logging_use_ops | bool
|
|
|
-
|
|
|
-- name: Create new DeploymentConfig names for Elasticsearch Ops
|
|
|
- set_fact: es_ops_dc_pool={{es_ops_dc_pool | default([]) + [deploy_name]}}
|
|
|
- vars:
|
|
|
- component: es-ops
|
|
|
- es_cluster_name: "{{component}}"
|
|
|
- deploy_name_prefix: "logging-{{component}}"
|
|
|
- deploy_name: "{{deploy_name_prefix}}-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"
|
|
|
- cluster_size: "{{openshift_logging_es_ops_cluster_size|int}}"
|
|
|
- with_sequence: count={{ openshift_logging_es_ops_cluster_size | int - openshift_logging_current_es_ops_size | int }}
|
|
|
+ loop_var: deployment
|
|
|
when:
|
|
|
- - openshift_logging_use_ops | bool
|
|
|
- check_mode: no
|
|
|
+ - openshift_logging_use_ops | bool
|
|
|
+## if it does not then we should create one that does and attach it
|
|
|
|
|
|
-- name: Generate Elasticsearch DeploymentConfig for Ops
|
|
|
- template: src=es.j2 dest={{mktemp.stdout}}/templates/logging-{{deploy_name}}-dc.yaml
|
|
|
+## create new dc/pvc is needed
|
|
|
+- include: set_es_storage.yaml
|
|
|
vars:
|
|
|
- component: es-ops
|
|
|
- logging_component: elasticsearch
|
|
|
- deploy_name_prefix: "logging-{{component}}"
|
|
|
- image: "{{openshift_logging_image_prefix}}logging-elasticsearch:{{openshift_logging_image_version}}"
|
|
|
- pvc_claim: "{{(es_pvc_pool | length > item.0) | ternary(es_pvc_pool[item.0], None)}}"
|
|
|
- deploy_name: "{{item.1}}"
|
|
|
- es_cluster_name: "{{component}}"
|
|
|
- es_cpu_limit: "{{openshift_logging_es_ops_cpu_limit }}"
|
|
|
- es_memory_limit: "{{openshift_logging_es_ops_memory_limit}}"
|
|
|
- es_node_quorum: "{{es_ops_node_quorum}}"
|
|
|
- es_recover_after_nodes: "{{es_ops_recover_after_nodes}}"
|
|
|
- es_recover_expected_nodes: "{{es_ops_recover_expected_nodes}}"
|
|
|
- openshift_logging_es_recover_after_time: "{{openshift_logging_es_ops_recover_after_time}}"
|
|
|
- es_node_selector: "{{openshift_logging_es_ops_nodeselector | default({}) }}"
|
|
|
- es_storage: "{{openshift_logging_facts|es_storage(deploy_name, pvc_claim,root='elasticsearch_ops')}}"
|
|
|
+ es_component: es-ops
|
|
|
+ es_name: "logging-es-ops-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"
|
|
|
+ es_spec: "{}"
|
|
|
+ es_node_selector: "{{ openshift_logging_es_ops_nodeselector | default({}) }}"
|
|
|
+ es_pvc_names: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() }}"
|
|
|
+ es_pvc_size: "{{ openshift_logging_es_ops_pvc_size }}"
|
|
|
+ es_pvc_prefix: "{{ openshift_logging_es_ops_pvc_prefix }}"
|
|
|
+ es_pvc_dynamic: "{{ openshift_logging_es_ops_pvc_dynamic | bool }}"
|
|
|
+ es_pv_selector: "{{ openshift_logging_es_ops_pv_selector }}"
|
|
|
+ es_cpu_limit: "{{ openshift_logging_es_ops_cpu_limit }}"
|
|
|
+ es_memory_limit: "{{ openshift_logging_es_ops_memory_limit }}"
|
|
|
es_number_of_shards: "{{ openshift_logging_es_ops_number_of_shards }}"
|
|
|
es_number_of_replicas: "{{ openshift_logging_es_ops_number_of_replicas }}"
|
|
|
- with_indexed_items:
|
|
|
- - "{{ es_ops_dc_pool | default([]) }}"
|
|
|
+ with_sequence: count={{ openshift_logging_es_ops_cluster_size | int - openshift_logging_facts.elasticsearch_ops.deploymentconfigs | count }}
|
|
|
when:
|
|
|
- - openshift_logging_use_ops | bool
|
|
|
- check_mode: no
|
|
|
- changed_when: no
|
|
|
+ - openshift_logging_use_ops | bool
|