install_logging.yaml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. - find: paths={{ mktemp.stdout }}/templates patterns=*.yaml
  24. register: object_def_files
  25. changed_when: no
  26. - slurp: src={{item}}
  27. register: object_defs
  28. with_items: "{{object_def_files.files | map(attribute='path') | list | sort}}"
  29. changed_when: no
  30. - name: Create objects
  31. include: oc_apply.yaml
  32. vars:
  33. - kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  34. - namespace: "{{ openshift_logging_namespace }}"
  35. - file_name: "{{ file.source }}"
  36. - file_content: "{{ file.content | b64decode | from_yaml }}"
  37. with_items: "{{ object_defs.results }}"
  38. loop_control:
  39. loop_var: file
  40. when: not ansible_check_mode
  41. - name: Printing out objects to create
  42. debug: msg={{file.content | b64decode }}
  43. with_items: "{{ object_defs.results }}"
  44. loop_control:
  45. loop_var: file
  46. when: ansible_check_mode
  47. - name: Scaling up cluster
  48. include: start_cluster.yaml
  49. when: start_cluster | default(true) | bool