install_logging.yaml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. - name: Gather OpenShift Logging Facts
  3. openshift_logging_facts:
  4. oc_bin: "{{openshift.common.client_binary}}"
  5. admin_kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
  6. openshift_logging_namespace: "{{openshift_logging_namespace}}"
  7. tags: logging_facts
  8. check_mode: no
  9. - name: Validate Elasticsearch cluster size
  10. fail: msg="The openshift_logging_es_cluster_size may not be scaled down more than 1 less (or 0) the number of Elasticsearch nodes already deployed"
  11. when: "{{openshift_logging_facts.elasticsearch.deploymentconfigs | length - openshift_logging_es_cluster_size | abs > 1}}"
  12. - name: Install logging
  13. include: "{{ role_path }}/tasks/install_{{ install_component }}.yaml"
  14. when: openshift_hosted_logging_install | default(true) | bool
  15. with_items:
  16. - support
  17. - elasticsearch
  18. - kibana
  19. - curator
  20. - fluentd
  21. loop_control:
  22. loop_var: install_component
  23. - name: Register API objects from generated templates
  24. shell: ls -d -1 {{mktemp.stdout}}/templates/* | sort
  25. register: logging_objects
  26. check_mode: no
  27. - name: Creating API objects from generated templates
  28. command: >
  29. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig apply -f {{file}} -n {{openshift_logging_namespace}}
  30. with_items: "{{logging_objects.stdout_lines}}"
  31. loop_control:
  32. loop_var: file
  33. when: not ansible_check_mode
  34. - name: Printing out objects to create
  35. debug: msg="{{lookup('file', file)|quote}}"
  36. with_fileglob:
  37. - "{{mktemp.stdout}}/templates/*.yaml"
  38. loop_control:
  39. loop_var: file
  40. when: ansible_check_mode
  41. - name: Scaling up cluster
  42. include: start_cluster.yaml
  43. when: start_cluster | default(true) | bool