--- - name: Set default image variables based on deployment_type include_vars: "{{ var_file_name }}" with_first_found: - "{{ openshift_deployment_type }}.yml" - "default_images.yml" loop_control: loop_var: var_file_name - name: Set curator image facts set_fact: 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) }}" - include_tasks: determine_version.yaml - name: Ensure that logging curator has nodes to run on fail: msg: |- No schedulable nodes found matching node selector for logging curator - '{{ openshift_logging_curator_nodeselector }}' when: - openshift_schedulable_node_labels | lib_utils_oo_has_no_matching_selector(openshift_logging_curator_nodeselector) # allow passing in a tempdir - name: Create temp directory for doing work in command: mktemp -d /tmp/openshift-logging-ansible-XXXXXX register: mktemp changed_when: False - set_fact: tempdir: "{{ mktemp.stdout }}" # This may not be necessary in this role - name: Create templates subdirectory file: state: directory path: "{{ tempdir }}/templates" mode: 0755 changed_when: False # we want to make sure we have all the necessary components here # service account - name: Create Curator service account oc_serviceaccount: state: present name: "aggregated-logging-curator" namespace: "{{ openshift_logging_namespace }}" image_pull_secrets: "{{ openshift_logging_image_pull_secret }}" when: openshift_logging_image_pull_secret != '' - name: Create Curator service account oc_serviceaccount: state: present name: "aggregated-logging-curator" namespace: "{{ openshift_logging_namespace }}" 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: state: present name: "logging-curator" namespace: "{{ openshift_logging_namespace }}" files: - name: ca path: "{{ generated_certs_dir }}/ca.crt" - name: key path: "{{ generated_certs_dir }}/system.logging.curator.key" - name: cert path: "{{ generated_certs_dir }}/system.logging.curator.crt" - set_fact: 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 - name: Delete temp directory file: name: "{{ tempdir }}" state: absent changed_when: False