generate_configmaps.yaml 4.4 KB

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