generate_configmaps.yaml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ---
  2. - block:
  3. - fail:
  4. msg: "The openshift_logging_es_log_appenders '{{openshift_logging_es_log_appenders}}' has an unrecognized option and only supports the following as a list: {{es_log_appenders | join(', ')}}"
  5. when:
  6. - es_logging_contents is undefined
  7. - "{{ openshift_logging_es_log_appenders | list | difference(es_log_appenders) | length != 0 }}"
  8. changed_when: no
  9. - template:
  10. src: elasticsearch-logging.yml.j2
  11. dest: "{{mktemp.stdout}}/elasticsearch-logging.yml"
  12. vars:
  13. root_logger: "{{openshift_logging_es_log_appenders | join(', ')}}"
  14. when: es_logging_contents is undefined
  15. changed_when: no
  16. check_mode: no
  17. - local_action: >
  18. template src=elasticsearch.yml.j2
  19. dest="{{local_tmp.stdout}}/elasticsearch-gen-template.yml"
  20. vars:
  21. - allow_cluster_reader: "{{openshift_logging_es_ops_allow_cluster_reader | lower | default('false')}}"
  22. when: es_config_contents is undefined
  23. changed_when: no
  24. - copy:
  25. content: "{{ config_source | combine(override_config,recursive=True) | to_nice_yaml }}"
  26. dest: "{{mktemp.stdout}}/elasticsearch.yml"
  27. vars:
  28. config_source: "{{lookup('file','{{local_tmp.stdout}}/elasticsearch-gen-template.yml') | from_yaml }}"
  29. override_config: "{{openshift_logging_es_config | from_yaml}}"
  30. when: es_logging_contents is undefined
  31. changed_when: no
  32. - copy:
  33. content: "{{es_logging_contents}}"
  34. dest: "{{mktemp.stdout}}/elasticsearch-logging.yml"
  35. when: es_logging_contents is defined
  36. changed_when: no
  37. - copy:
  38. content: "{{es_config_contents}}"
  39. dest: "{{mktemp.stdout}}/elasticsearch.yml"
  40. when: es_config_contents is defined
  41. changed_when: no
  42. - command: >
  43. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create configmap logging-elasticsearch
  44. --from-file=logging.yml={{mktemp.stdout}}/elasticsearch-logging.yml --from-file=elasticsearch.yml={{mktemp.stdout}}/elasticsearch.yml -o yaml --dry-run
  45. register: es_configmap
  46. changed_when: no
  47. - copy:
  48. content: "{{es_configmap.stdout}}"
  49. dest: "{{mktemp.stdout}}/templates/logging-elasticsearch-configmap.yaml"
  50. when: es_configmap.stdout is defined
  51. changed_when: no
  52. check_mode: no
  53. - block:
  54. - copy:
  55. src: curator.yml
  56. dest: "{{mktemp.stdout}}/curator.yml"
  57. when: curator_config_contents is undefined
  58. changed_when: no
  59. - copy:
  60. content: "{{curator_config_contents}}"
  61. dest: "{{mktemp.stdout}}/curator.yml"
  62. when: curator_config_contents is defined
  63. changed_when: no
  64. - command: >
  65. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create configmap logging-curator
  66. --from-file=config.yaml={{mktemp.stdout}}/curator.yml -o yaml --dry-run
  67. register: curator_configmap
  68. changed_when: no
  69. - copy:
  70. content: "{{curator_configmap.stdout}}"
  71. dest: "{{mktemp.stdout}}/templates/logging-curator-configmap.yaml"
  72. when: curator_configmap.stdout is defined
  73. changed_when: no
  74. check_mode: no
  75. - block:
  76. - copy:
  77. src: fluent.conf
  78. dest: "{{mktemp.stdout}}/fluent.conf"
  79. when: fluentd_config_contents is undefined
  80. changed_when: no
  81. - copy:
  82. src: fluentd-throttle-config.yaml
  83. dest: "{{mktemp.stdout}}/fluentd-throttle-config.yaml"
  84. when: fluentd_throttle_contents is undefined
  85. changed_when: no
  86. - copy:
  87. src: secure-forward.conf
  88. dest: "{{mktemp.stdout}}/secure-forward.conf"
  89. when: fluentd_securefoward_contents is undefined
  90. changed_when: no
  91. - copy:
  92. content: "{{fluentd_config_contents}}"
  93. dest: "{{mktemp.stdout}}/fluent.conf"
  94. when: fluentd_config_contents is defined
  95. changed_when: no
  96. - copy:
  97. content: "{{fluentd_throttle_contents}}"
  98. dest: "{{mktemp.stdout}}/fluentd-throttle-config.yaml"
  99. when: fluentd_throttle_contents is defined
  100. changed_when: no
  101. - copy:
  102. content: "{{fluentd_secureforward_contents}}"
  103. dest: "{{mktemp.stdout}}/secure-forward.conf"
  104. when: fluentd_secureforward_contents is defined
  105. changed_when: no
  106. - command: >
  107. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create configmap logging-fluentd
  108. --from-file=fluent.conf={{mktemp.stdout}}/fluent.conf --from-file=throttle-config.yaml={{mktemp.stdout}}/fluentd-throttle-config.yaml
  109. --from-file=secure-forward.conf={{mktemp.stdout}}/secure-forward.conf -o yaml --dry-run
  110. register: fluentd_configmap
  111. changed_when: no
  112. - copy:
  113. content: "{{fluentd_configmap.stdout}}"
  114. dest: "{{mktemp.stdout}}/templates/logging-fluentd-configmap.yaml"
  115. when: fluentd_configmap.stdout is defined
  116. changed_when: no
  117. check_mode: no