install_logging.yaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 only be scaled down manually. Please see official documentation on how to do this."
  11. when: openshift_logging_facts.elasticsearch.deploymentconfigs | length > openshift_logging_es_cluster_size|int
  12. - name: Validate Elasticsearch Ops cluster size
  13. fail: msg="The openshift_logging_es_ops_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
  14. when: openshift_logging_facts.elasticsearch_ops.deploymentconfigs | length > openshift_logging_es_ops_cluster_size|int
  15. - name: Install logging
  16. include: "{{ role_path }}/tasks/install_{{ install_component }}.yaml"
  17. when: openshift_hosted_logging_install | default(true) | bool
  18. with_items:
  19. - support
  20. - elasticsearch
  21. - kibana
  22. - curator
  23. - fluentd
  24. loop_control:
  25. loop_var: install_component
  26. - name: Install logging mux
  27. include: "{{ role_path }}/tasks/install_mux.yaml"
  28. when: openshift_logging_use_mux
  29. - find: paths={{ mktemp.stdout }}/templates patterns=*.yaml
  30. register: object_def_files
  31. changed_when: no
  32. - slurp: src={{item}}
  33. register: object_defs
  34. with_items: "{{object_def_files.files | map(attribute='path') | list | sort}}"
  35. changed_when: no
  36. - name: Create objects
  37. include: oc_apply.yaml
  38. vars:
  39. - kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  40. - namespace: "{{ openshift_logging_namespace }}"
  41. - file_name: "{{ file.source }}"
  42. - file_content: "{{ file.content | b64decode | from_yaml }}"
  43. with_items: "{{ object_defs.results }}"
  44. loop_control:
  45. loop_var: file
  46. when: not ansible_check_mode
  47. - include: update_master_config.yaml
  48. - name: Printing out objects to create
  49. debug: msg={{file.content | b64decode }}
  50. with_items: "{{ object_defs.results }}"
  51. loop_control:
  52. loop_var: file
  53. when: ansible_check_mode
  54. # TODO replace task with oc_secret module that supports
  55. # linking when available
  56. - name: Link Pull Secrets With Service Accounts
  57. include: oc_secret.yaml
  58. vars:
  59. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  60. subcommand: link
  61. service_account: "{{sa_account}}"
  62. secret_name: "{{openshift_logging_image_pull_secret}}"
  63. add_args: "--for=pull"
  64. with_items:
  65. - default
  66. - aggregated-logging-elasticsearch
  67. - aggregated-logging-kibana
  68. - aggregated-logging-fluentd
  69. - aggregated-logging-curator
  70. register: link_pull_secret
  71. loop_control:
  72. loop_var: sa_account
  73. when:
  74. - openshift_logging_image_pull_secret is defined
  75. - openshift_logging_image_pull_secret != ''
  76. failed_when: link_pull_secret.rc != 0
  77. - name: Scaling up cluster
  78. include: start_cluster.yaml
  79. when: start_cluster | default(true) | bool