123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- ---
- - 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
- # 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: curator.yml
- dest: "{{ tempdir }}/curator.yml"
- when: curator_config_contents is undefined
- changed_when: no
- - copy:
- content: "{{ curator_config_contents }}"
- dest: "{{ tempdir }}/curator.yml"
- when: curator_config_contents is defined
- changed_when: no
- - 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: 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
|