|
@@ -2,30 +2,12 @@
|
|
|
- name: Gather OpenShift Logging Facts
|
|
|
openshift_logging_facts:
|
|
|
oc_bin: "{{openshift.common.client_binary}}"
|
|
|
- admin_kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
|
|
|
openshift_logging_namespace: "{{openshift_logging_namespace}}"
|
|
|
- tags: logging_facts
|
|
|
- check_mode: no
|
|
|
|
|
|
-- name: Validate Elasticsearch cluster size
|
|
|
- fail: msg="The openshift_logging_es_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
|
|
|
- when: openshift_logging_facts.elasticsearch.deploymentconfigs | length > openshift_logging_es_cluster_size|int
|
|
|
-
|
|
|
-- name: Validate Elasticsearch Ops cluster size
|
|
|
- fail: msg="The openshift_logging_es_ops_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
|
|
|
- when: openshift_logging_facts.elasticsearch_ops.deploymentconfigs | length > openshift_logging_es_ops_cluster_size|int
|
|
|
-
|
|
|
-- name: Install logging
|
|
|
- include: "{{ role_path }}/tasks/install_{{ install_component }}.yaml"
|
|
|
- when: openshift_hosted_logging_install | default(true) | bool
|
|
|
- with_items:
|
|
|
- - support
|
|
|
- - elasticsearch
|
|
|
- - kibana
|
|
|
- - curator
|
|
|
- - fluentd
|
|
|
- loop_control:
|
|
|
- loop_var: install_component
|
|
|
+- name: Set logging project
|
|
|
+ oc_project:
|
|
|
+ state: present
|
|
|
+ name: "{{ openshift_logging_namespace }}"
|
|
|
|
|
|
- name: Install logging mux
|
|
|
include: "{{ role_path }}/tasks/install_mux.yaml"
|
|
@@ -35,56 +17,162 @@
|
|
|
register: object_def_files
|
|
|
changed_when: no
|
|
|
|
|
|
-- slurp: src={{item}}
|
|
|
- register: object_defs
|
|
|
- with_items: "{{object_def_files.files | map(attribute='path') | list | sort}}"
|
|
|
- changed_when: no
|
|
|
+- name: Create logging cert directory
|
|
|
+ file:
|
|
|
+ path: "{{ openshift.common.config_base }}/logging"
|
|
|
+ state: directory
|
|
|
+ mode: 0755
|
|
|
+ changed_when: False
|
|
|
+ check_mode: no
|
|
|
|
|
|
-- name: Create objects
|
|
|
- include: oc_apply.yaml
|
|
|
+- include: generate_certs.yaml
|
|
|
vars:
|
|
|
- - kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
|
|
|
- - namespace: "{{ openshift_logging_namespace }}"
|
|
|
- - file_name: "{{ file.source }}"
|
|
|
- - file_content: "{{ file.content | b64decode | from_yaml }}"
|
|
|
- with_items: "{{ object_defs.results }}"
|
|
|
- loop_control:
|
|
|
- loop_var: file
|
|
|
- when: not ansible_check_mode
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
|
|
|
-- include: update_master_config.yaml
|
|
|
+## Elasticsearch
|
|
|
+
|
|
|
+# TODO: add more vars
|
|
|
+# We don't allow scaling down of ES nodes currently
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_elasticsearch
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_elasticsearch_deployment_name: "{{ item.0 }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_name: "{{ item.1 }}"
|
|
|
+ openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_cluster_size | int }}"
|
|
|
+
|
|
|
+ #openshift_logging_elasticsearch_storage_type: "{{ }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_size: "{{ openshift_logging_es_pvc_size }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_pv_selector: "{{ openshift_logging_es_pv_selector }}"
|
|
|
+
|
|
|
+ with_together:
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs }}"
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch.pvcs }}"
|
|
|
+
|
|
|
+# Create any new DC that may be required
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_elasticsearch
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_elasticsearch_pvc_name: "{{ openshift_logging_es_pvc_prefix }}-{{ item | int + openshift_logging_facts.elasticsearch.deploymentconfigs | count }}"
|
|
|
+ openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_cluster_size | int }}"
|
|
|
+
|
|
|
+ with_sequence: count={{ openshift_logging_es_cluster_size | int - openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count }}
|
|
|
+
|
|
|
+# TODO: add more vars
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_elasticsearch
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_elasticsearch_deployment_name: "{{ item.0 }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_name: "{{ item.1 }}"
|
|
|
+ openshift_logging_elasticsearch_ops_deployment: true
|
|
|
+ openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_ops_cluster_size | int }}"
|
|
|
+
|
|
|
+ #openshift_logging_elasticsearch_storage_type: "{{ }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_size: "{{ openshift_logging_es_pvc_size }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic }}"
|
|
|
+ openshift_logging_elasticsearch_pvc_pv_selector: "{{ openshift_logging_es_pv_selector }}"
|
|
|
+
|
|
|
+ with_together:
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs }}"
|
|
|
+ - "{{ openshift_logging_facts.elasticsearch_ops.pvcs }}"
|
|
|
+ when:
|
|
|
+ - openshift_logging_use_ops | bool
|
|
|
+
|
|
|
+# Create any new DC that may be required
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_elasticsearch
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_elasticsearch_pvc_name: "{{ openshift_logging_es_pvc_prefix }}-{{ item | int + openshift_logging_facts.elasticsearch_ops.deploymentconfigs | count }}"
|
|
|
+ openshift_logging_elasticsearch_ops_deployment: true
|
|
|
+ openshift_logging_elasticsearch_replica_count: "{{ openshift_logging_es_ops_cluster_size | int }}"
|
|
|
+
|
|
|
+ with_sequence: count={{ ( ( openshift_logging_es_ops_cluster_size | int ) - ( openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count ) ) }}
|
|
|
+ when:
|
|
|
+ - openshift_logging_use_ops | bool
|
|
|
|
|
|
-- name: Printing out objects to create
|
|
|
- debug: msg={{file.content | b64decode }}
|
|
|
- with_items: "{{ object_defs.results }}"
|
|
|
- loop_control:
|
|
|
- loop_var: file
|
|
|
- when: ansible_check_mode
|
|
|
-
|
|
|
- # TODO replace task with oc_secret module that supports
|
|
|
- # linking when available
|
|
|
-- name: Link Pull Secrets With Service Accounts
|
|
|
- include: oc_secret.yaml
|
|
|
+
|
|
|
+## Kibana
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_kibana
|
|
|
vars:
|
|
|
- kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
|
|
|
- subcommand: link
|
|
|
- service_account: "{{sa_account}}"
|
|
|
- secret_name: "{{openshift_logging_image_pull_secret}}"
|
|
|
- add_args: "--for=pull"
|
|
|
- with_items:
|
|
|
- - default
|
|
|
- - aggregated-logging-elasticsearch
|
|
|
- - aggregated-logging-kibana
|
|
|
- - aggregated-logging-fluentd
|
|
|
- - aggregated-logging-curator
|
|
|
- register: link_pull_secret
|
|
|
- loop_control:
|
|
|
- loop_var: sa_account
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_kibana_namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ openshift_logging_kibana_master_url: "{{ openshift_logging_master_url }}"
|
|
|
+ openshift_logging_kibana_master_public_url: "{{ openshift_logging_master_public_url }}"
|
|
|
+ openshift_logging_kibana_image_prefix: "{{ openshift_logging_image_prefix }}"
|
|
|
+ openshift_logging_kibana_image_version: "{{ openshift_logging_image_version }}"
|
|
|
+ openshift_logging_kibana_replicas: "{{ openshift_logging_kibana_replica_count }}"
|
|
|
+ openshift_logging_kibana_es_host: "{{ openshift_logging_es_host }}"
|
|
|
+ openshift_logging_kibana_es_port: "{{ openshift_logging_es_port }}"
|
|
|
+ openshift_logging_kibana_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
|
|
|
+
|
|
|
+
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_kibana
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_kibana_ops_deployment: true
|
|
|
+ openshift_logging_kibana_namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ openshift_logging_kibana_master_url: "{{ openshift_logging_master_url }}"
|
|
|
+ openshift_logging_kibana_master_public_url: "{{ openshift_logging_master_public_url }}"
|
|
|
+ openshift_logging_kibana_image_prefix: "{{ openshift_logging_image_prefix }}"
|
|
|
+ openshift_logging_kibana_image_version: "{{ openshift_logging_image_version }}"
|
|
|
+ openshift_logging_kibana_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
|
|
|
+ openshift_logging_kibana_es_host: "{{ openshift_logging_es_ops_host }}"
|
|
|
+ openshift_logging_kibana_es_port: "{{ openshift_logging_es_ops_port }}"
|
|
|
+ openshift_logging_kibana_nodeselector: "{{ openshift_logging_kibana_ops_nodeselector }}"
|
|
|
+ openshift_logging_kibana_cpu_limit: "{{ openshift_logging_kibana_ops_cpu_limit }}"
|
|
|
+ openshift_logging_kibana_memory_limit: "{{ openshift_logging_kibana_ops_memory_limit }}"
|
|
|
+ openshift_logging_kibana_hostname: "{{ openshift_logging_kibana_ops_hostname }}"
|
|
|
+ openshift_logging_kibana_replicas: "{{ openshift_logging_kibana_ops_replica_count }}"
|
|
|
+ openshift_logging_kibana_proxy_debug: "{{ openshift_logging_kibana_ops_proxy_debug }}"
|
|
|
+ openshift_logging_kibana_proxy_cpu_limit: "{{ openshift_logging_kibana_ops_proxy_cpu_limit }}"
|
|
|
+ openshift_logging_kibana_proxy_memory_limit: "{{ openshift_logging_kibana_ops_proxy_memory_limit }}"
|
|
|
+ openshift_logging_kibana_cert: "{{ openshift_logging_kibana_ops_cert }}"
|
|
|
+ openshift_logging_kibana_key: "{{ openshift_logging_kibana_ops_key }}"
|
|
|
+ openshift_logging_kibana_ca: "{{ openshift_logging_kibana_ops_ca}}"
|
|
|
when:
|
|
|
- - openshift_logging_image_pull_secret is defined
|
|
|
- - openshift_logging_image_pull_secret != ''
|
|
|
- failed_when: link_pull_secret.rc != 0
|
|
|
+ - openshift_logging_use_ops | bool
|
|
|
|
|
|
-- name: Scaling up cluster
|
|
|
- include: start_cluster.yaml
|
|
|
- when: start_cluster | default(true) | bool
|
|
|
+
|
|
|
+## Curator
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_curator
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_curator_namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ openshift_logging_curator_master_url: "{{ openshift_logging_master_url }}"
|
|
|
+ openshift_logging_curator_image_prefix: "{{ openshift_logging_image_prefix }}"
|
|
|
+ openshift_logging_curator_image_version: "{{ openshift_logging_image_version }}"
|
|
|
+ openshift_logging_curator_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
|
|
|
+
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_curator
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_curator_ops_deployment: true
|
|
|
+ openshift_logging_curator_namespace: "{{ openshift_logging_namespace }}"
|
|
|
+ openshift_logging_curator_master_url: "{{ openshift_logging_master_url }}"
|
|
|
+ openshift_logging_curator_image_prefix: "{{ openshift_logging_image_prefix }}"
|
|
|
+ openshift_logging_curator_image_version: "{{ openshift_logging_image_version }}"
|
|
|
+ openshift_logging_curator_image_pull_secret: "{{ openshift_logging_image_pull_secret }}"
|
|
|
+ openshift_logging_curator_cpu_limit: "{{ openshift_logging_curator_ops_cpu_limit }}"
|
|
|
+ openshift_logging_curator_memory_limit: "{{ openshift_logging_curator_ops_memory_limit }}"
|
|
|
+ openshift_logging_curator_nodeselector: "{{ openshift_logging_curator_ops_nodeselector }}"
|
|
|
+ when:
|
|
|
+ - openshift_logging_use_ops | bool
|
|
|
+
|
|
|
+
|
|
|
+## Fluentd
|
|
|
+- include_role:
|
|
|
+ name: openshift_logging_fluentd
|
|
|
+ vars:
|
|
|
+ generated_certs_dir: "{{openshift.common.config_base}}/logging"
|
|
|
+ openshift_logging_fluentd_ops_host: "{{ ( openshift_logging_use_ops | bool ) | ternary('logging-es-ops', 'logging-es') }}"
|
|
|
+ openshift_logging_fluentd_use_journal: "{{ openshift.docker.options | search('journald') }}"
|
|
|
+
|
|
|
+- include: update_master_config.yaml
|