|
@@ -12,6 +12,10 @@
|
|
|
openshift_logging_curator_image_prefix: "{{ openshift_logging_curator_image_prefix | default(__openshift_logging_curator_image_prefix) }}"
|
|
|
openshift_logging_curator_image_version: "{{ openshift_logging_curator_image_version | default(__openshift_logging_curator_image_version) }}"
|
|
|
|
|
|
+- name: Detect running upgrade
|
|
|
+ set_fact:
|
|
|
+ is_upgrade: "{{ openshift_logging_facts['curator']['configmaps']['logging-curator'] is defined }}"
|
|
|
+
|
|
|
- name: Ensure that Logging Curator has nodes to run on
|
|
|
import_role:
|
|
|
name: openshift_master
|
|
@@ -56,30 +60,6 @@
|
|
|
when:
|
|
|
- openshift_logging_image_pull_secret == ''
|
|
|
|
|
|
-# configmap
|
|
|
-- copy:
|
|
|
- src: "{{ __base_file_dir }}/curator.yml"
|
|
|
- dest: "{{ tempdir }}/curator.yml"
|
|
|
- changed_when: no
|
|
|
-
|
|
|
-- import_role:
|
|
|
- name: openshift_logging
|
|
|
- tasks_from: patch_configmap_files.yaml
|
|
|
- vars:
|
|
|
- configmap_name: "logging-curator"
|
|
|
- configmap_namespace: "logging"
|
|
|
- configmap_file_names:
|
|
|
- - current_file: "config.yaml"
|
|
|
- new_file: "{{ tempdir }}/curator.yml"
|
|
|
-
|
|
|
-- name: Set Curator configmap
|
|
|
- oc_configmap:
|
|
|
- state: present
|
|
|
- name: "logging-curator"
|
|
|
- namespace: "{{ openshift_logging_namespace }}"
|
|
|
- from_file:
|
|
|
- config.yaml: "{{ tempdir }}/curator.yml"
|
|
|
-
|
|
|
# secret
|
|
|
- name: Set Curator secret
|
|
|
oc_secret:
|
|
@@ -98,36 +78,137 @@
|
|
|
curator_name: "{{ 'logging-curator' ~ ( (openshift_logging_curator_ops_deployment | default(false) | bool) | ternary('-ops', '') ) }}"
|
|
|
curator_component: "{{ 'curator' ~ ( (openshift_logging_curator_ops_deployment | default(false) | bool) | ternary('-ops', '') ) }}"
|
|
|
|
|
|
-# DC
|
|
|
-# TODO: scale should not exceed 1
|
|
|
-- name: Generate Curator deploymentconfig
|
|
|
- template:
|
|
|
- src: "{{ __base_file_dir }}/curator.j2"
|
|
|
- dest: "{{ tempdir }}/templates/curator-dc.yaml"
|
|
|
- vars:
|
|
|
- component: "{{ curator_component }}"
|
|
|
- logging_component: curator
|
|
|
- deploy_name: "{{ curator_name }}"
|
|
|
- image: "{{openshift_logging_curator_image_prefix}}logging-curator:{{openshift_logging_curator_image_version}}"
|
|
|
- es_host: "{{ openshift_logging_curator_es_host }}"
|
|
|
- es_port: "{{ openshift_logging_curator_es_port }}"
|
|
|
- curator_cpu_limit: "{{ openshift_logging_curator_cpu_limit }}"
|
|
|
- curator_cpu_request: "{{ openshift_logging_curator_cpu_request | min_cpu(openshift_logging_curator_cpu_limit | default(none)) }}"
|
|
|
- curator_memory_limit: "{{ openshift_logging_curator_memory_limit }}"
|
|
|
- curator_replicas: "{{ openshift_logging_curator_replicas | default (1) }}"
|
|
|
- curator_node_selector: "{{openshift_logging_curator_nodeselector | default({})}}"
|
|
|
- check_mode: no
|
|
|
- changed_when: no
|
|
|
-
|
|
|
-- name: Set Curator DC
|
|
|
- oc_obj:
|
|
|
- state: present
|
|
|
- name: "{{ curator_name }}"
|
|
|
- namespace: "{{ openshift_logging_namespace }}"
|
|
|
- kind: dc
|
|
|
- files:
|
|
|
- - "{{ tempdir }}/templates/curator-dc.yaml"
|
|
|
- delete_after: true
|
|
|
+# Deployment Config - v2.x
|
|
|
+- when: not openshift_logging_es5_techpreview
|
|
|
+ block:
|
|
|
+ - name: Generate Curator deploymentconfig
|
|
|
+ template:
|
|
|
+ src: "{{ __base_file_dir }}/curator.j2"
|
|
|
+ dest: "{{ tempdir }}/templates/curator-dc.yaml"
|
|
|
+ vars:
|
|
|
+ component: "{{ curator_component }}"
|
|
|
+ logging_component: curator
|
|
|
+ deploy_name: "{{ curator_name }}"
|
|
|
+ image: "{{openshift_logging_curator_image_prefix}}logging-curator:{{openshift_logging_curator_image_version}}"
|
|
|
+ es_host: "{{ openshift_logging_curator_es_host }}"
|
|
|
+ es_port: "{{ openshift_logging_curator_es_port }}"
|
|
|
+ curator_cpu_limit: "{{ openshift_logging_curator_cpu_limit }}"
|
|
|
+ curator_cpu_request: "{{ openshift_logging_curator_cpu_request | min_cpu(openshift_logging_curator_cpu_limit | default(none)) }}"
|
|
|
+ curator_memory_limit: "{{ openshift_logging_curator_memory_limit }}"
|
|
|
+ curator_replicas: "{{ openshift_logging_curator_replicas | default (1) }}"
|
|
|
+ curator_node_selector: "{{openshift_logging_curator_nodeselector | default({})}}"
|
|
|
+ check_mode: no
|
|
|
+ changed_when: no
|
|
|
+
|
|
|
+ - copy:
|
|
|
+ src: "{{ __base_file_dir }}/curator.yml"
|
|
|
+ dest: "{{ tempdir }}/curator.yml"
|
|
|
+ changed_when: no
|
|
|
+
|
|
|
+ - import_role:
|
|
|
+ name: openshift_logging
|
|
|
+ tasks_from: patch_configmap_files.yaml
|
|
|
+ vars:
|
|
|
+ configmap_name: "logging-curator"
|
|
|
+ configmap_namespace: "logging"
|
|
|
+ configmap_file_names:
|
|
|
+ - current_file: "config.yaml"
|
|
|
+ new_file: "{{ tempdir }}/curator.yml"
|
|
|
+
|
|
|
+ - name: Set Curator configmap
|
|
|
+ oc_configmap:
|
|
|
+ state: present
|
|
|
+ name: "logging-curator"
|
|
|
+ namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ from_file:
|
|
|
+ config.yaml: "{{ tempdir }}/curator.yml"
|
|
|
+
|
|
|
+ - name: Set Curator DC
|
|
|
+ oc_obj:
|
|
|
+ state: present
|
|
|
+ name: "{{ curator_name }}"
|
|
|
+ namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ kind: dc
|
|
|
+ files:
|
|
|
+ - "{{ tempdir }}/templates/curator-dc.yaml"
|
|
|
+ delete_after: true
|
|
|
+
|
|
|
+# Cron Job - v5.x
|
|
|
+- when: openshift_logging_es5_techpreview | bool
|
|
|
+ block:
|
|
|
+ # Keep the old DC around
|
|
|
+ - name: Scale the old DC to 0
|
|
|
+ oc_scale:
|
|
|
+ name: "{{ curator_name }}"
|
|
|
+ namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ kind: dc
|
|
|
+ replicas: 0
|
|
|
+ when: is_upgrade | bool
|
|
|
+
|
|
|
+ - name: Generate Curator cronjob
|
|
|
+ template:
|
|
|
+ src: "{{ __base_file_dir }}/curator-cj.j2"
|
|
|
+ dest: "{{ tempdir }}/templates/curator-cj.yaml"
|
|
|
+ vars:
|
|
|
+ component: "{{ curator_component }}"
|
|
|
+ logging_component: curator
|
|
|
+ deploy_name: "{{ curator_name }}"
|
|
|
+ image: "{{openshift_logging_curator_image_prefix}}logging-curator:{{openshift_logging_curator_image_version}}"
|
|
|
+ es_host: "{{ openshift_logging_curator_es_host }}"
|
|
|
+ es_port: "{{ openshift_logging_curator_es_port }}"
|
|
|
+ curator_cpu_limit: "{{ openshift_logging_curator_cpu_limit }}"
|
|
|
+ curator_cpu_request: "{{ openshift_logging_curator_cpu_request | min_cpu(openshift_logging_curator_cpu_limit | default(none)) }}"
|
|
|
+ curator_memory_limit: "{{ openshift_logging_curator_memory_limit }}"
|
|
|
+ curator_node_selector: "{{openshift_logging_curator_nodeselector | default({})}}"
|
|
|
+ cron_job_schedule: "{{ openshift_logging_curator_run_minute | default(0) }} {{ openshift_logging_curator_run_hour | default(0) }} * * *"
|
|
|
+ check_mode: no
|
|
|
+ changed_when: no
|
|
|
+
|
|
|
+ # Copy config files
|
|
|
+ - copy:
|
|
|
+ src: "{{ __base_file_dir }}/{{ item }}"
|
|
|
+ dest: "{{ tempdir }}/{{ item }}"
|
|
|
+ with_items:
|
|
|
+ - "actions.yaml"
|
|
|
+ - "config.yaml"
|
|
|
+ - "curator.yml"
|
|
|
+
|
|
|
+ # Patch existing configuration, if present
|
|
|
+ - import_role:
|
|
|
+ name: openshift_logging
|
|
|
+ tasks_from: patch_configmap_files.yaml
|
|
|
+ vars:
|
|
|
+ configmap_name: "logging-curator"
|
|
|
+ configmap_namespace: "logging"
|
|
|
+ configmap_file_names:
|
|
|
+ - current_file: "actions.yaml"
|
|
|
+ new_file: "{{ tempdir }}/actions.yaml"
|
|
|
+ - current_file: "curator5.yaml"
|
|
|
+ new_file: "{{ tempdir }}/config.yaml"
|
|
|
+ - current_file: "config.yaml"
|
|
|
+ new_file: "{{ tempdir }}/curator.yml"
|
|
|
+
|
|
|
+ # Create cronjob
|
|
|
+ - name: Set Curator Cronjob
|
|
|
+ oc_obj:
|
|
|
+ state: present
|
|
|
+ name: "{{ curator_name }}"
|
|
|
+ namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ kind: cronjob
|
|
|
+ files:
|
|
|
+ - "{{ tempdir }}/templates/curator-cj.yaml"
|
|
|
+ delete_after: true
|
|
|
+
|
|
|
+ # Create config map
|
|
|
+ - name: Set Curator configmap
|
|
|
+ oc_configmap:
|
|
|
+ state: present
|
|
|
+ name: "logging-curator"
|
|
|
+ namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ from_file:
|
|
|
+ actions.yaml: "{{ tempdir }}/actions.yaml"
|
|
|
+ curator5.yaml: "{{ tempdir }}/config.yaml"
|
|
|
+ config.yaml: "{{ tempdir }}/curator.yml"
|
|
|
|
|
|
- name: Delete temp directory
|
|
|
file:
|