From ea71f3a00c1749e43cba6b821480a5966bbfc22e Mon Sep 17 00:00:00 2001 From: John Kwiatkoski Date: Fri, 18 Mar 2016 10:29:22 -0400 Subject: Adding openshift_efk role --- roles/openshift_efk/README.md | 9 ++ roles/openshift_efk/files/logging-deployer-sa.yaml | 6 + roles/openshift_efk/tasks/main.yaml | 179 +++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 roles/openshift_efk/README.md create mode 100644 roles/openshift_efk/files/logging-deployer-sa.yaml create mode 100644 roles/openshift_efk/tasks/main.yaml diff --git a/roles/openshift_efk/README.md b/roles/openshift_efk/README.md new file mode 100644 index 000000000..d948dad5d --- /dev/null +++ b/roles/openshift_efk/README.md @@ -0,0 +1,9 @@ +###Required vars: + +- kibana_hostname: kibana.example.com +- es_cluster_size: 1 +- master_url: https://localhost:8443 + +###Optional vars: +- logging_secret_vars: (defaults to nothing=/dev/null) kibana.crt=/etc/origin/master/ca.crt kibana.key=/etc/origin/master/ca.key ca.crt=/etc/origin/master/ca.crt ca.key=/etc/origin/master/ca.key +- fluentd_replicas: (defaults to 1) 3 diff --git a/roles/openshift_efk/files/logging-deployer-sa.yaml b/roles/openshift_efk/files/logging-deployer-sa.yaml new file mode 100644 index 000000000..334c9402b --- /dev/null +++ b/roles/openshift_efk/files/logging-deployer-sa.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: logging-deployer +secrets: +- name: logging-deployer diff --git a/roles/openshift_efk/tasks/main.yaml b/roles/openshift_efk/tasks/main.yaml new file mode 100644 index 000000000..aff3d09fb --- /dev/null +++ b/roles/openshift_efk/tasks/main.yaml @@ -0,0 +1,179 @@ +--- + + - fail: msg="This role requires the following vars to be defined: master_url, kibana_hostname, es_cluster_size" + when: "kibana_hostname is not defined or + es_cluster_size is not defined or + master_url is not defined" + + - name: "Checking for logging project" + command: oc get project logging + register: logging_project + failed_when: "'FAILED' in logging_project.stderr" + tags: + - cleanup + + - name: "Create logging project" + command: oadm new-project logging + when: logging_project.rc != 0 + tags: + - build + - name: "Changing projects" + command: oc project logging + tags: + - cleanup + + - name: "Cleanup any previous logging infrastructure" + command: oc delete all --selector logging-infra={{ item }} + with_items: + - kibana + - fluentd + - elasticsearch + ignore_errors: yes + tags: + - cleanup + + - name: "Cleanup existing support infrastructure" + command: oc delete all,sa,oauthclient --selector logging-infra=support + ignore_errors: yes + tags: + - cleanup + + - name: "Cleanup existing secrets" + command: oc delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy + ignore_errors: yes + register: clean_result + failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr + tags: + - cleanup + + - name: "Cleanup existing logging deployers" + command: oc delete pods --all + tags: + - cleanup + + - name: "Creating logging deployer secret" + command: oc secrets new logging-deployer {{ logging_secret_vars | default('nothing=/dev/null') }} + register: secret_output + failed_when: "secret_output.rc == 1 and 'exists' not in secret_output.stderr" + tags: + - build + + - name: "Copy serviceAccount file" + copy: dest=/tmp/logging-deployer-sa.yaml + src={{role_path}}/files/logging-deployer-sa.yaml + force=yes + tags: + - build + + - name: "Create logging-deployer service account" + shell: oc create -f /tmp/logging-deployer-sa.yaml + register: deployer_output + failed_when: "deployer_output.rc == 1 and 'exists' not in deployer_output.stderr" + tags: + - build + + - name: "Set permissions for logging-deployer service account" + command: oc policy add-role-to-user edit system:serviceaccount:logging:logging-deployer + register: permiss_output + failed_when: "permiss_output.rc == 1 and 'exists' not in permiss_output.stderr" + tags: + - build + + - name: "Set permissions for fluentd" + command: oadm policy add-scc-to-user privileged system:serviceaccount:logging:aggregated-logging-fluentd + register: fluentd_output + failed_when: "fluentd_output.rc == 1 and 'exists' not in fluentd_output.stderr" + tags: + - build + + - name: "Set additional permissions for fluentd" + command: oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:logging:aggregated-logging-fluentd + register: fluentd2_output + failed_when: "fluentd2_output.rc == 1 and 'exists' not in fluentd2_output.stderr" + tags: + - build + + - name: "Make sure to remove stale deployer template" + command: oc delete template logging-deployer-template -n openshift + register: delete_ouput + failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr + tags: + - build + + - name: "Create deployer template" + command: oc create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift + register: template_output + failed_when: "template_output.rc == 1 and 'exists' not in template_output.stderr" + tags: + - build + + - name: "Clear out any previous pods" + command: oc delete pods --all + tags: + - build + + - name: "Process the deployer template with an registry other than registry.access.redhat.com" + shell: oc process logging-deployer-template -n openshift -v KIBANA_HOSTNAME={{ kibana_hostname | quote }},ES_CLUSTER_SIZE={{ es_cluster_size | quote }},PUBLIC_MASTER_URL={{ master_url | quote }},IMAGE_PREFIX={{ target_registry | quote }}/ | oc create -f - + when: target_registry is defined + tags: + - build + + - name: "Process the default deployer template" + shell: oc process logging-deployer-template -n openshift -v KIBANA_HOSTNAME={{ kibana_hostname | quote }},ES_CLUSTER_SIZE={{ es_cluster_size | quote }},PUBLIC_MASTER_URL={{ master_url | quote }} | oc create -f - + when: target_registry is not defined + tags: + - build + + - name: "Wait for image pull and deployer pod" + action: shell oc get pods | grep logging-deployer.*Completed + register: result + until: result.rc == 0 + retries: 15 + delay: 10 + tags: + - build + + - name: "Process support template" + shell: oc process logging-support-template | oc create -f - + tags: + - build + + - name: "Set insecured registry" + command: oc annotate is --all openshift.io/image.insecureRepository=true --overwrite + when: "target_registry is defined and insecure_registry == 'true'" + tags: + - build + + - name: "Scale fluentd deployment config" + command: oc scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }} + tags: + - build + + - name: "Wait for imagestreams to become available" + action: shell oc get is | grep logging-fluentd + register: result + until: result.rc == 0 + failed_when: result.rc == 1 and 'not found' not in result.stderr + retries: 15 + delay: 5 + tags: + - build + + - name: "Wait for replication controllers to become available" + action: shell oc get rc | grep logging-fluentd-1 + register: result + until: result.rc == 0 + failed_when: result.rc == 1 and 'not found' not in result.stderr + retries: 15 + delay: 5 + tags: + - build + + - name: "Scale fluentd replication controller" + command: oc scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }} + tags: + - build + + - debug: msg="Logging components deployed. Note persistant volume for elasticsearch must be setup manually" + tags: + - build -- cgit v1.2.3 From 7fa2d035c9f2051e5e07134522871ea23f85e52c Mon Sep 17 00:00:00 2001 From: John Kwiatkoski Date: Tue, 22 Mar 2016 14:48:31 -0400 Subject: revised and restructured logging role --- roles/openshift_efk/README.md | 9 -- roles/openshift_efk/files/logging-deployer-sa.yaml | 6 - roles/openshift_efk/tasks/main.yaml | 179 --------------------- roles/openshift_hosted_logging/README.md | 10 ++ .../files/logging-deployer-sa.yaml | 6 + .../files/openshift_hosted_logging_efk.yaml | 4 + .../tasks/cleanup_logging.yaml | 76 +++++++++ .../tasks/deploy_logging.yaml | 107 ++++++++++++ roles/openshift_hosted_logging/tasks/main.yaml | 8 + roles/openshift_hosted_logging/vars/main.yaml | 5 + 10 files changed, 216 insertions(+), 194 deletions(-) delete mode 100644 roles/openshift_efk/README.md delete mode 100644 roles/openshift_efk/files/logging-deployer-sa.yaml delete mode 100644 roles/openshift_efk/tasks/main.yaml create mode 100644 roles/openshift_hosted_logging/README.md create mode 100644 roles/openshift_hosted_logging/files/logging-deployer-sa.yaml create mode 100644 roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml create mode 100644 roles/openshift_hosted_logging/tasks/cleanup_logging.yaml create mode 100644 roles/openshift_hosted_logging/tasks/deploy_logging.yaml create mode 100644 roles/openshift_hosted_logging/tasks/main.yaml create mode 100644 roles/openshift_hosted_logging/vars/main.yaml diff --git a/roles/openshift_efk/README.md b/roles/openshift_efk/README.md deleted file mode 100644 index d948dad5d..000000000 --- a/roles/openshift_efk/README.md +++ /dev/null @@ -1,9 +0,0 @@ -###Required vars: - -- kibana_hostname: kibana.example.com -- es_cluster_size: 1 -- master_url: https://localhost:8443 - -###Optional vars: -- logging_secret_vars: (defaults to nothing=/dev/null) kibana.crt=/etc/origin/master/ca.crt kibana.key=/etc/origin/master/ca.key ca.crt=/etc/origin/master/ca.crt ca.key=/etc/origin/master/ca.key -- fluentd_replicas: (defaults to 1) 3 diff --git a/roles/openshift_efk/files/logging-deployer-sa.yaml b/roles/openshift_efk/files/logging-deployer-sa.yaml deleted file mode 100644 index 334c9402b..000000000 --- a/roles/openshift_efk/files/logging-deployer-sa.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: logging-deployer -secrets: -- name: logging-deployer diff --git a/roles/openshift_efk/tasks/main.yaml b/roles/openshift_efk/tasks/main.yaml deleted file mode 100644 index aff3d09fb..000000000 --- a/roles/openshift_efk/tasks/main.yaml +++ /dev/null @@ -1,179 +0,0 @@ ---- - - - fail: msg="This role requires the following vars to be defined: master_url, kibana_hostname, es_cluster_size" - when: "kibana_hostname is not defined or - es_cluster_size is not defined or - master_url is not defined" - - - name: "Checking for logging project" - command: oc get project logging - register: logging_project - failed_when: "'FAILED' in logging_project.stderr" - tags: - - cleanup - - - name: "Create logging project" - command: oadm new-project logging - when: logging_project.rc != 0 - tags: - - build - - name: "Changing projects" - command: oc project logging - tags: - - cleanup - - - name: "Cleanup any previous logging infrastructure" - command: oc delete all --selector logging-infra={{ item }} - with_items: - - kibana - - fluentd - - elasticsearch - ignore_errors: yes - tags: - - cleanup - - - name: "Cleanup existing support infrastructure" - command: oc delete all,sa,oauthclient --selector logging-infra=support - ignore_errors: yes - tags: - - cleanup - - - name: "Cleanup existing secrets" - command: oc delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy - ignore_errors: yes - register: clean_result - failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr - tags: - - cleanup - - - name: "Cleanup existing logging deployers" - command: oc delete pods --all - tags: - - cleanup - - - name: "Creating logging deployer secret" - command: oc secrets new logging-deployer {{ logging_secret_vars | default('nothing=/dev/null') }} - register: secret_output - failed_when: "secret_output.rc == 1 and 'exists' not in secret_output.stderr" - tags: - - build - - - name: "Copy serviceAccount file" - copy: dest=/tmp/logging-deployer-sa.yaml - src={{role_path}}/files/logging-deployer-sa.yaml - force=yes - tags: - - build - - - name: "Create logging-deployer service account" - shell: oc create -f /tmp/logging-deployer-sa.yaml - register: deployer_output - failed_when: "deployer_output.rc == 1 and 'exists' not in deployer_output.stderr" - tags: - - build - - - name: "Set permissions for logging-deployer service account" - command: oc policy add-role-to-user edit system:serviceaccount:logging:logging-deployer - register: permiss_output - failed_when: "permiss_output.rc == 1 and 'exists' not in permiss_output.stderr" - tags: - - build - - - name: "Set permissions for fluentd" - command: oadm policy add-scc-to-user privileged system:serviceaccount:logging:aggregated-logging-fluentd - register: fluentd_output - failed_when: "fluentd_output.rc == 1 and 'exists' not in fluentd_output.stderr" - tags: - - build - - - name: "Set additional permissions for fluentd" - command: oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:logging:aggregated-logging-fluentd - register: fluentd2_output - failed_when: "fluentd2_output.rc == 1 and 'exists' not in fluentd2_output.stderr" - tags: - - build - - - name: "Make sure to remove stale deployer template" - command: oc delete template logging-deployer-template -n openshift - register: delete_ouput - failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr - tags: - - build - - - name: "Create deployer template" - command: oc create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift - register: template_output - failed_when: "template_output.rc == 1 and 'exists' not in template_output.stderr" - tags: - - build - - - name: "Clear out any previous pods" - command: oc delete pods --all - tags: - - build - - - name: "Process the deployer template with an registry other than registry.access.redhat.com" - shell: oc process logging-deployer-template -n openshift -v KIBANA_HOSTNAME={{ kibana_hostname | quote }},ES_CLUSTER_SIZE={{ es_cluster_size | quote }},PUBLIC_MASTER_URL={{ master_url | quote }},IMAGE_PREFIX={{ target_registry | quote }}/ | oc create -f - - when: target_registry is defined - tags: - - build - - - name: "Process the default deployer template" - shell: oc process logging-deployer-template -n openshift -v KIBANA_HOSTNAME={{ kibana_hostname | quote }},ES_CLUSTER_SIZE={{ es_cluster_size | quote }},PUBLIC_MASTER_URL={{ master_url | quote }} | oc create -f - - when: target_registry is not defined - tags: - - build - - - name: "Wait for image pull and deployer pod" - action: shell oc get pods | grep logging-deployer.*Completed - register: result - until: result.rc == 0 - retries: 15 - delay: 10 - tags: - - build - - - name: "Process support template" - shell: oc process logging-support-template | oc create -f - - tags: - - build - - - name: "Set insecured registry" - command: oc annotate is --all openshift.io/image.insecureRepository=true --overwrite - when: "target_registry is defined and insecure_registry == 'true'" - tags: - - build - - - name: "Scale fluentd deployment config" - command: oc scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }} - tags: - - build - - - name: "Wait for imagestreams to become available" - action: shell oc get is | grep logging-fluentd - register: result - until: result.rc == 0 - failed_when: result.rc == 1 and 'not found' not in result.stderr - retries: 15 - delay: 5 - tags: - - build - - - name: "Wait for replication controllers to become available" - action: shell oc get rc | grep logging-fluentd-1 - register: result - until: result.rc == 0 - failed_when: result.rc == 1 and 'not found' not in result.stderr - retries: 15 - delay: 5 - tags: - - build - - - name: "Scale fluentd replication controller" - command: oc scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }} - tags: - - build - - - debug: msg="Logging components deployed. Note persistant volume for elasticsearch must be setup manually" - tags: - - build diff --git a/roles/openshift_hosted_logging/README.md b/roles/openshift_hosted_logging/README.md new file mode 100644 index 000000000..b3f363571 --- /dev/null +++ b/roles/openshift_hosted_logging/README.md @@ -0,0 +1,10 @@ +###Required vars: + +- openshift_hosted_logging_hostname: kibana.example.com +- openshift_hosted_logging_elasticsearch_cluster_size: 1 +- openshift_hosted_logging_master_public_url: https://localhost:8443 + +###Optional vars: +- openshift_hosted_logging_secret_vars: (defaults to nothing=/dev/null) kibana.crt=/etc/origin/master/ca.crt kibana.key=/etc/origin/master/ca.key ca.crt=/etc/origin/master/ca.crt ca.key=/etc/origin/master/ca.key +- openshift_hosted_logging_fluentd_replicas: (defaults to 1) 3 +- openshift_hosted_logging_cleanup: (defaults to no) Set this to 'yes' in order to cleanup logging components instead of deploying. diff --git a/roles/openshift_hosted_logging/files/logging-deployer-sa.yaml b/roles/openshift_hosted_logging/files/logging-deployer-sa.yaml new file mode 100644 index 000000000..334c9402b --- /dev/null +++ b/roles/openshift_hosted_logging/files/logging-deployer-sa.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: logging-deployer +secrets: +- name: logging-deployer diff --git a/roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml b/roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml new file mode 100644 index 000000000..f55db11ac --- /dev/null +++ b/roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml @@ -0,0 +1,4 @@ +- hosts: my_master_host + roles: + - role: openshift_hosted_logging + openshift_hosted_logging_cleanup: no diff --git a/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml b/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml new file mode 100644 index 000000000..23a514ffd --- /dev/null +++ b/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml @@ -0,0 +1,76 @@ +--- + + - name: "Checking for logging project" + command: oc get project logging + register: logging_project + failed_when: "'FAILED' in logging_project.stderr" + tags: + - cleanup + + - name: "Changing projects" + command: oc project logging + tags: + - cleanup + - build + + - name: Create temp directory for kubeconfig + command: mktemp -d /tmp/openshift-ansible-XXXXXX + register: mktemp + changed_when: False + + - name: Copy the admin client config(s) + command: > + cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig + changed_when: False + + - name: "Changing projects" + command: oc project logging + tags: + - cleanup + - build + + + - name: "Cleanup any previous logging infrastructure" + command: oc delete --ignore-not-found all --selector logging-infra={{ item }} + with_items: + - kibana + - fluentd + - elasticsearch + ignore_errors: yes + tags: + - cleanup + + + - name: "Cleanup existing support infrastructure" + command: oc delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support + ignore_errors: yes + tags: + - cleanup + + - name: "Cleanup existing secrets" + command: oc delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy + ignore_errors: yes + register: clean_result + failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr + tags: + - cleanup + + - name: "Cleanup existing logging deployers" + command: oc delete pods --all + tags: + - cleanup + + - name: "Make sure to remove deployer template" + command: oc delete template logging-deployer-template -n openshift + register: delete_ouput + failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr + tags: + - cleanup + + - name: Delete temp directory + file: + name: "{{ mktemp.stdout }}" + state: absent + changed_when: False + + - debug: msg="Success!" diff --git a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml new file mode 100644 index 000000000..5d69175ae --- /dev/null +++ b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml @@ -0,0 +1,107 @@ +--- + + - fail: msg="This role requires the following vars to be defined: openshift_hosted_logging_master_public_url, openshift_hosted_logging_hostname, penshift_hosted_logging_elasticsearchs_cluster_size" + when: "openshift_hosted_logging_hostname is not defined or + penshift_hosted_logging_elasticsearchs_cluster_size is not defined or + openshift_hosted_logging_master_public_url is not defined" + + - name: Create temp directory for kubeconfig + command: mktemp -d /tmp/openshift-ansible-XXXXXX + register: mktemp + changed_when: False + + - name: Copy the admin client config(s) + command: > + cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig + changed_when: False + + + - name: "Create logging project" + command: oadm new-project logging + when: logging_project.rc != 0 + + + - name: "Changing projects" + command: oc project logging + + - name: "Creating logging deployer secret" + command: oc secrets new logging-deployer {{ openshift_hosted_logging_secret_vars | default('nothing=/dev/null') }} + register: secret_output + failed_when: "secret_output.rc == 1 and 'exists' not in secret_output.stderr" + + - name: "Copy serviceAccount file" + copy: dest=/tmp/logging-deployer-sa.yaml + src={{role_path}}/files/logging-deployer-sa.yaml + force=yes + + - name: "Create logging-deployer service account" + shell: oc create -f /tmp/logging-deployer-sa.yaml + register: deployer_output + failed_when: "deployer_output.rc == 1 and 'exists' not in deployer_output.stderr" + + - name: "Set permissions for logging-deployer service account" + command: oc policy add-role-to-user edit system:serviceaccount:logging:logging-deployer + register: permiss_output + failed_when: "permiss_output.rc == 1 and 'exists' not in permiss_output.stderr" + + - name: "Set permissions for fluentd" + command: oadm policy add-scc-to-user privileged system:serviceaccount:logging:aggregated-logging-fluentd + register: fluentd_output + failed_when: "fluentd_output.rc == 1 and 'exists' not in fluentd_output.stderr" + + - name: "Set additional permissions for fluentd" + command: oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:logging:aggregated-logging-fluentd + register: fluentd2_output + failed_when: "fluentd2_output.rc == 1 and 'exists' not in fluentd2_output.stderr" + + - name: "Create deployer template" + command: oc create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift + register: template_output + failed_when: "template_output.rc == 1 and 'exists' not in template_output.stderr" + + - name: "Process the deployer template with an registry other than registry.access.redhat.com" + shell: oc process logging-deployer-template -n openshift -v {{ oc_process_values}} | oc create -f - + + - name: "Wait for image pull and deployer pod" + shell: oc get pods | grep logging-deployer.*Completed + register: result + until: result.rc == 0 + retries: 15 + delay: 10 + + - name: "Process support template" + shell: oc process logging-support-template | oc create -f - + + - name: "Set insecured registry" + command: oc annotate is --all openshift.io/image.insecureRepository=true --overwrite + when: "target_registry is defined and insecure_registry == 'true'" + + - name: "Scale fluentd deployment config" + command: oc scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }} + + - name: "Wait for imagestreams to become available" + shell: oc get is | grep logging-fluentd + register: result + until: result.rc == 0 + failed_when: result.rc == 1 and 'not found' not in result.stderr + retries: 15 + delay: 5 + + - name: "Wait for replication controllers to become available" + shell: oc get rc | grep logging-fluentd-1 + register: result + until: result.rc == 0 + failed_when: result.rc == 1 and 'not found' not in result.stderr + retries: 15 + delay: 5 + + - name: "Scale fluentd replication controller" + command: oc scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }} + + - debug: msg="Logging components deployed. Note persistant volume for elasticsearch must be setup manually" + + - name: Delete temp directory + file: + name: "{{ mktemp.stdout }}" + state: absent + changed_when: False diff --git a/roles/openshift_hosted_logging/tasks/main.yaml b/roles/openshift_hosted_logging/tasks/main.yaml new file mode 100644 index 000000000..aea53804a --- /dev/null +++ b/roles/openshift_hosted_logging/tasks/main.yaml @@ -0,0 +1,8 @@ +--- +- name: Cleanup logging deployment + include: {{ role_path }}/tasks/cleanup_logging.yaml + when: openshift_hosted_logging_cleanup | default(false) | bool + +- name: Deploy logging + include: {{ role_path }}/tasks/deploy_logging.yaml + when: not openshift_hosted_logging_cleanup | default(false) | bool diff --git a/roles/openshift_hosted_logging/vars/main.yaml b/roles/openshift_hosted_logging/vars/main.yaml new file mode 100644 index 000000000..7baef0311 --- /dev/null +++ b/roles/openshift_hosted_logging/vars/main.yaml @@ -0,0 +1,5 @@ +kh_kv: KIBANA_HOSTNAME={{ openshift_hosted_logging_hostname | quote }} +es_cs_kv: ES_CLUSTER_SIZE={{ openshift_hosted_logging_elasticsearch_cluster_size | quote }} +pmu_kv: PUBLIC_MASTER_URL={{ openshift_hosted_logging_master_public_url | quote }} +ip_kv: "{{ 'IMAGE_PREFIX=' ~ target_registry | quote if target_registry is defined else '' }}" +oc_process_values: "{{ kh_kv }} {{ es_cs_kv }} {{ pmu_kv }} {{ ip_kv }}" -- cgit v1.2.3 From a181c8705a4730eebc35339c55e39ca7ff3bf90c Mon Sep 17 00:00:00 2001 From: John Kwiatkoski Date: Wed, 23 Mar 2016 14:43:43 -0400 Subject: Tested of refactored code --- .../files/openshift_hosted_logging_efk.yaml | 4 -- roles/openshift_hosted_logging/meta/main.yaml | 3 + .../tasks/cleanup_logging.yaml | 47 ++++++--------- .../tasks/deploy_logging.yaml | 68 +++++++++++----------- roles/openshift_hosted_logging/tasks/main.yaml | 4 +- roles/openshift_hosted_logging/vars/main.yaml | 9 +-- 6 files changed, 60 insertions(+), 75 deletions(-) delete mode 100644 roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml create mode 100644 roles/openshift_hosted_logging/meta/main.yaml diff --git a/roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml b/roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml deleted file mode 100644 index f55db11ac..000000000 --- a/roles/openshift_hosted_logging/files/openshift_hosted_logging_efk.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- hosts: my_master_host - roles: - - role: openshift_hosted_logging - openshift_hosted_logging_cleanup: no diff --git a/roles/openshift_hosted_logging/meta/main.yaml b/roles/openshift_hosted_logging/meta/main.yaml new file mode 100644 index 000000000..b695bde87 --- /dev/null +++ b/roles/openshift_hosted_logging/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - { role: openshift_common } diff --git a/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml b/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml index 23a514ffd..9d3ab3015 100644 --- a/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml +++ b/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml @@ -4,14 +4,9 @@ command: oc get project logging register: logging_project failed_when: "'FAILED' in logging_project.stderr" - tags: - - cleanup - name: "Changing projects" - command: oc project logging - tags: - - cleanup - - build + command: "{{ openshift.common.client_binary }} project logging" - name: Create temp directory for kubeconfig command: mktemp -d /tmp/openshift-ansible-XXXXXX @@ -25,52 +20,44 @@ - name: "Changing projects" command: oc project logging - tags: - - cleanup - - build - name: "Cleanup any previous logging infrastructure" - command: oc delete --ignore-not-found all --selector logging-infra={{ item }} + command: "{{ openshift.common.client_binary }} delete --ignore-not-found all --selector logging-infra={{ item }}" with_items: - kibana - fluentd - elasticsearch ignore_errors: yes - tags: - - cleanup - - name: "Cleanup existing support infrastructure" - command: oc delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support + command: "{{ openshift.common.client_binary }} delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support" ignore_errors: yes - tags: - - cleanup - name: "Cleanup existing secrets" - command: oc delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy + command: "{{ openshift.common.client_binary }} delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy" ignore_errors: yes register: clean_result failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr - tags: - - cleanup - name: "Cleanup existing logging deployers" - command: oc delete pods --all - tags: - - cleanup + command: "{{ openshift.common.client_binary }} delete pods --all" + + + - name: "Cleanup logging project" + command: "{{ openshift.common.client_binary }} delete project logging" - - name: "Make sure to remove deployer template" - command: oc delete template logging-deployer-template -n openshift + + - name: "Remove deployer template" + command: "{{ openshift.common.client_binary }} delete template logging-deployer-template -n openshift" register: delete_ouput failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr - tags: - - cleanup + - name: Delete temp directory - file: - name: "{{ mktemp.stdout }}" - state: absent - changed_when: False + file: + name: "{{ mktemp.stdout }}" + state: absent + changed_when: False - debug: msg="Success!" diff --git a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml index 5d69175ae..a1ef2081f 100644 --- a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml +++ b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml @@ -1,8 +1,7 @@ --- - - - fail: msg="This role requires the following vars to be defined: openshift_hosted_logging_master_public_url, openshift_hosted_logging_hostname, penshift_hosted_logging_elasticsearchs_cluster_size" + - fail: msg="This role requires the following vars to be defined. openshift_hosted_logging_master_public_url, openshift_hosted_logging_hostname, openshift_hosted_logging_elasticsearch_cluster_size" when: "openshift_hosted_logging_hostname is not defined or - penshift_hosted_logging_elasticsearchs_cluster_size is not defined or + openshift_hosted_logging_elasticsearch_cluster_size is not defined or openshift_hosted_logging_master_public_url is not defined" - name: Create temp directory for kubeconfig @@ -15,17 +14,14 @@ cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig changed_when: False - - name: "Create logging project" command: oadm new-project logging - when: logging_project.rc != 0 - - name: "Changing projects" - command: oc project logging + command: "{{ openshift.common.client_binary }} project logging" - name: "Creating logging deployer secret" - command: oc secrets new logging-deployer {{ openshift_hosted_logging_secret_vars | default('nothing=/dev/null') }} + command: " {{ openshift.common.client_binary }} secrets new logging-deployer {{ openshift_hosted_logging_secret_vars | default('nothing=/dev/null') }}" register: secret_output failed_when: "secret_output.rc == 1 and 'exists' not in secret_output.stderr" @@ -35,12 +31,12 @@ force=yes - name: "Create logging-deployer service account" - shell: oc create -f /tmp/logging-deployer-sa.yaml + command: "{{ openshift.common.client_binary }} create -f /tmp/logging-deployer-sa.yaml" register: deployer_output failed_when: "deployer_output.rc == 1 and 'exists' not in deployer_output.stderr" - name: "Set permissions for logging-deployer service account" - command: oc policy add-role-to-user edit system:serviceaccount:logging:logging-deployer + command: "{{ openshift.common.client_binary }} policy add-role-to-user edit system:serviceaccount:logging:logging-deployer" register: permiss_output failed_when: "permiss_output.rc == 1 and 'exists' not in permiss_output.stderr" @@ -55,53 +51,55 @@ failed_when: "fluentd2_output.rc == 1 and 'exists' not in fluentd2_output.stderr" - name: "Create deployer template" - command: oc create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift + command: "{{ openshift.common.client_binary }} create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift" register: template_output failed_when: "template_output.rc == 1 and 'exists' not in template_output.stderr" - - name: "Process the deployer template with an registry other than registry.access.redhat.com" - shell: oc process logging-deployer-template -n openshift -v {{ oc_process_values}} | oc create -f - + - name: "Process the deployer template" + shell: "{{ openshift.common.client_binary }} process logging-deployer-template -n openshift -v {{ oc_process_values }} | {{ openshift.common.client_binary }} create -f -" - name: "Wait for image pull and deployer pod" - shell: oc get pods | grep logging-deployer.*Completed - register: result - until: result.rc == 0 - retries: 15 - delay: 10 + shell: "{{ openshift.common.client_binary }} get pods | grep logging-deployer.*Completed" + register: result + until: result.rc == 0 + retries: 15 + delay: 10 - name: "Process support template" - shell: oc process logging-support-template | oc create -f - + shell: "{{ openshift.common.client_binary }} process logging-support-template | {{ openshift.common.client_binary }} create -f -" - name: "Set insecured registry" - command: oc annotate is --all openshift.io/image.insecureRepository=true --overwrite + command: "{{ openshift.common.client_binary }} annotate is --all openshift.io/image.insecureRepository=true --overwrite" when: "target_registry is defined and insecure_registry == 'true'" - - name: "Scale fluentd deployment config" - command: oc scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }} - - name: "Wait for imagestreams to become available" - shell: oc get is | grep logging-fluentd + shell: "{{ openshift.common.client_binary }} get is | grep logging-fluentd" register: result until: result.rc == 0 failed_when: result.rc == 1 and 'not found' not in result.stderr - retries: 15 - delay: 5 - + retries: 20 + delay: 10 + - name: "Wait for replication controllers to become available" - shell: oc get rc | grep logging-fluentd-1 + shell: "{{ openshift.common.client_binary }} get rc | grep logging-fluentd-1" register: result until: result.rc == 0 failed_when: result.rc == 1 and 'not found' not in result.stderr - retries: 15 - delay: 5 + retries: 20 + delay: 10 + + + - name: "Scale fluentd deployment config" + command: "{{ openshift.common.client_binary }} scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }}" + - name: "Scale fluentd replication controller" - command: oc scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }} + command: "{{ openshift.common.client_binary }} scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }}" - debug: msg="Logging components deployed. Note persistant volume for elasticsearch must be setup manually" - name: Delete temp directory - file: - name: "{{ mktemp.stdout }}" - state: absent - changed_when: False + file: + name: "{{ mktemp.stdout }}" + state: absent + changed_when: False diff --git a/roles/openshift_hosted_logging/tasks/main.yaml b/roles/openshift_hosted_logging/tasks/main.yaml index aea53804a..42568597a 100644 --- a/roles/openshift_hosted_logging/tasks/main.yaml +++ b/roles/openshift_hosted_logging/tasks/main.yaml @@ -1,8 +1,8 @@ --- - name: Cleanup logging deployment - include: {{ role_path }}/tasks/cleanup_logging.yaml + include: "{{ role_path }}/tasks/cleanup_logging.yaml" when: openshift_hosted_logging_cleanup | default(false) | bool - name: Deploy logging - include: {{ role_path }}/tasks/deploy_logging.yaml + include: "{{ role_path }}/tasks/deploy_logging.yaml" when: not openshift_hosted_logging_cleanup | default(false) | bool diff --git a/roles/openshift_hosted_logging/vars/main.yaml b/roles/openshift_hosted_logging/vars/main.yaml index 7baef0311..586c2ab91 100644 --- a/roles/openshift_hosted_logging/vars/main.yaml +++ b/roles/openshift_hosted_logging/vars/main.yaml @@ -1,5 +1,6 @@ -kh_kv: KIBANA_HOSTNAME={{ openshift_hosted_logging_hostname | quote }} -es_cs_kv: ES_CLUSTER_SIZE={{ openshift_hosted_logging_elasticsearch_cluster_size | quote }} -pmu_kv: PUBLIC_MASTER_URL={{ openshift_hosted_logging_master_public_url | quote }} +kh_kv: "KIBANA_HOSTNAME={{ openshift_hosted_logging_hostname | quote }}" +es_cs_kv: "ES_CLUSTER_SIZE={{ openshift_hosted_logging_elasticsearch_cluster_size | quote }}" +pmu_kv: "PUBLIC_MASTER_URL={{ openshift_hosted_logging_master_public_url | quote }}" ip_kv: "{{ 'IMAGE_PREFIX=' ~ target_registry | quote if target_registry is defined else '' }}" -oc_process_values: "{{ kh_kv }} {{ es_cs_kv }} {{ pmu_kv }} {{ ip_kv }}" +oc_process_values: "{{ kh_kv }},{{ es_cs_kv }},{{ pmu_kv }},{{ ip_kv }}" +openshift_master_config_dir: "{{ openshift.common.config_base }}/master" -- cgit v1.2.3 From 6478134074009f276e36e455b3618b30c2a14c61 Mon Sep 17 00:00:00 2001 From: John Kwiatkoski Date: Wed, 23 Mar 2016 15:27:44 -0400 Subject: adding playbook --- playbooks/adhoc/openshift_hosted_logging_efk.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 playbooks/adhoc/openshift_hosted_logging_efk.yaml diff --git a/playbooks/adhoc/openshift_hosted_logging_efk.yaml b/playbooks/adhoc/openshift_hosted_logging_efk.yaml new file mode 100644 index 000000000..a3121d046 --- /dev/null +++ b/playbooks/adhoc/openshift_hosted_logging_efk.yaml @@ -0,0 +1,6 @@ +--- +- hosts: masters[0] + roles: + - role: openshift_hosted_logging + openshift_hosted_logging_cleanup: no + -- cgit v1.2.3 From 41fd8df9c6a9f3b7adda5c9331408482be9c666b Mon Sep 17 00:00:00 2001 From: John Kwiatkoski Date: Fri, 25 Mar 2016 11:36:14 -0400 Subject: added admin binary varibale usage as well as specifying kubeconfig copy to be used --- .../tasks/cleanup_logging.yaml | 28 ++++++++---------- .../tasks/deploy_logging.yaml | 34 +++++++++++----------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml b/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml index 9d3ab3015..8331f0389 100644 --- a/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml +++ b/roles/openshift_hosted_logging/tasks/cleanup_logging.yaml @@ -1,13 +1,4 @@ --- - - - name: "Checking for logging project" - command: oc get project logging - register: logging_project - failed_when: "'FAILED' in logging_project.stderr" - - - name: "Changing projects" - command: "{{ openshift.common.client_binary }} project logging" - - name: Create temp directory for kubeconfig command: mktemp -d /tmp/openshift-ansible-XXXXXX register: mktemp @@ -18,12 +9,17 @@ cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig changed_when: False + - name: "Checking for logging project" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get project logging" + register: logging_project + failed_when: "'FAILED' in logging_project.stderr" + - name: "Changing projects" - command: oc project logging + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig project logging" - name: "Cleanup any previous logging infrastructure" - command: "{{ openshift.common.client_binary }} delete --ignore-not-found all --selector logging-infra={{ item }}" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete --ignore-not-found all --selector logging-infra={{ item }}" with_items: - kibana - fluentd @@ -31,25 +27,25 @@ ignore_errors: yes - name: "Cleanup existing support infrastructure" - command: "{{ openshift.common.client_binary }} delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support" ignore_errors: yes - name: "Cleanup existing secrets" - command: "{{ openshift.common.client_binary }} delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy" ignore_errors: yes register: clean_result failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr - name: "Cleanup existing logging deployers" - command: "{{ openshift.common.client_binary }} delete pods --all" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete pods --all" - name: "Cleanup logging project" - command: "{{ openshift.common.client_binary }} delete project logging" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete project logging" - name: "Remove deployer template" - command: "{{ openshift.common.client_binary }} delete template logging-deployer-template -n openshift" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete template logging-deployer-template -n openshift" register: delete_ouput failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr diff --git a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml index a1ef2081f..d8a5b62a0 100644 --- a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml +++ b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml @@ -15,13 +15,13 @@ changed_when: False - name: "Create logging project" - command: oadm new-project logging + command: {{ openshift.common.admin_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig new-project logging - name: "Changing projects" - command: "{{ openshift.common.client_binary }} project logging" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig project logging" - name: "Creating logging deployer secret" - command: " {{ openshift.common.client_binary }} secrets new logging-deployer {{ openshift_hosted_logging_secret_vars | default('nothing=/dev/null') }}" + command: " {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig secrets new logging-deployer {{ openshift_hosted_logging_secret_vars | default('nothing=/dev/null') }}" register: secret_output failed_when: "secret_output.rc == 1 and 'exists' not in secret_output.stderr" @@ -31,57 +31,57 @@ force=yes - name: "Create logging-deployer service account" - command: "{{ openshift.common.client_binary }} create -f /tmp/logging-deployer-sa.yaml" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create -f /tmp/logging-deployer-sa.yaml" register: deployer_output failed_when: "deployer_output.rc == 1 and 'exists' not in deployer_output.stderr" - name: "Set permissions for logging-deployer service account" - command: "{{ openshift.common.client_binary }} policy add-role-to-user edit system:serviceaccount:logging:logging-deployer" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig policy add-role-to-user edit system:serviceaccount:logging:logging-deployer" register: permiss_output failed_when: "permiss_output.rc == 1 and 'exists' not in permiss_output.stderr" - name: "Set permissions for fluentd" - command: oadm policy add-scc-to-user privileged system:serviceaccount:logging:aggregated-logging-fluentd + command: {{ openshift.common.admin_binary}} policy add-scc-to-user privileged system:serviceaccount:logging:aggregated-logging-fluentd register: fluentd_output failed_when: "fluentd_output.rc == 1 and 'exists' not in fluentd_output.stderr" - name: "Set additional permissions for fluentd" - command: oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:logging:aggregated-logging-fluentd + command: {{ openshift.common.admin_binary}} policy add-cluster-role-to-user cluster-reader system:serviceaccount:logging:aggregated-logging-fluentd register: fluentd2_output failed_when: "fluentd2_output.rc == 1 and 'exists' not in fluentd2_output.stderr" - name: "Create deployer template" - command: "{{ openshift.common.client_binary }} create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create -f /usr/share/openshift/examples/infrastructure-templates/enterprise/logging-deployer.yaml -n openshift" register: template_output failed_when: "template_output.rc == 1 and 'exists' not in template_output.stderr" - name: "Process the deployer template" - shell: "{{ openshift.common.client_binary }} process logging-deployer-template -n openshift -v {{ oc_process_values }} | {{ openshift.common.client_binary }} create -f -" + shell: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig process logging-deployer-template -n openshift -v {{ oc_process_values }} | {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create -f -" - name: "Wait for image pull and deployer pod" - shell: "{{ openshift.common.client_binary }} get pods | grep logging-deployer.*Completed" + shell: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get pods | grep logging-deployer.*Completed" register: result until: result.rc == 0 retries: 15 delay: 10 - name: "Process support template" - shell: "{{ openshift.common.client_binary }} process logging-support-template | {{ openshift.common.client_binary }} create -f -" + shell: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig process logging-support-template | {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create -f -" - name: "Set insecured registry" - command: "{{ openshift.common.client_binary }} annotate is --all openshift.io/image.insecureRepository=true --overwrite" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig annotate is --all openshift.io/image.insecureRepository=true --overwrite" when: "target_registry is defined and insecure_registry == 'true'" - name: "Wait for imagestreams to become available" - shell: "{{ openshift.common.client_binary }} get is | grep logging-fluentd" + shell: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get is | grep logging-fluentd" register: result until: result.rc == 0 failed_when: result.rc == 1 and 'not found' not in result.stderr retries: 20 delay: 10 - + - name: "Wait for replication controllers to become available" - shell: "{{ openshift.common.client_binary }} get rc | grep logging-fluentd-1" + shell: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get rc | grep logging-fluentd-1" register: result until: result.rc == 0 failed_when: result.rc == 1 and 'not found' not in result.stderr @@ -90,11 +90,11 @@ - name: "Scale fluentd deployment config" - command: "{{ openshift.common.client_binary }} scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }}" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig scale dc/logging-fluentd --replicas={{ fluentd_replicas | default('1') }}" - name: "Scale fluentd replication controller" - command: "{{ openshift.common.client_binary }} scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }}" + command: "{{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig scale rc/logging-fluentd-1 --replicas={{ fluentd_replicas | default('1') }}" - debug: msg="Logging components deployed. Note persistant volume for elasticsearch must be setup manually" -- cgit v1.2.3