install_logging.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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
  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
  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. - find: paths={{ mktemp.stdout }}/templates patterns=*.yaml
  27. register: object_def_files
  28. changed_when: no
  29. - slurp: src={{item}}
  30. register: object_defs
  31. with_items: "{{object_def_files.files | map(attribute='path') | list | sort}}"
  32. changed_when: no
  33. - name: Create objects
  34. include: oc_apply.yaml
  35. vars:
  36. - kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  37. - namespace: "{{ openshift_logging_namespace }}"
  38. - file_name: "{{ file.source }}"
  39. - file_content: "{{ file.content | b64decode | from_yaml }}"
  40. with_items: "{{ object_defs.results }}"
  41. loop_control:
  42. loop_var: file
  43. when: not ansible_check_mode
  44. - include: update_master_config.yaml
  45. - name: Printing out objects to create
  46. debug: msg={{file.content | b64decode }}
  47. with_items: "{{ object_defs.results }}"
  48. loop_control:
  49. loop_var: file
  50. when: ansible_check_mode
  51. # TODO replace task with oc_secret module that supports
  52. # linking when available
  53. - name: Link Pull Secrets With Service Accounts
  54. include: oc_secret.yaml
  55. vars:
  56. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  57. subcommand: link
  58. service_account: "{{sa_account}}"
  59. secret_name: "{{openshift_logging_image_pull_secret}}"
  60. add_args: "--for=pull"
  61. with_items:
  62. - default
  63. - aggregated-logging-elasticsearch
  64. - aggregated-logging-kibana
  65. - aggregated-logging-fluentd
  66. - aggregated-logging-curator
  67. register: link_pull_secret
  68. loop_control:
  69. loop_var: sa_account
  70. when: openshift_logging_image_pull_secret is defined
  71. failed_when: link_pull_secret.rc != 0
  72. - name: Scaling up cluster
  73. include: start_cluster.yaml
  74. when: start_cluster | default(true) | bool