summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/tasks/generate_configmaps.yaml
blob: e57e564a4a941a925acfd1ea24830f1bd1b22b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
- block:
    - fail:
        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(', ')}}"
      when:
        - es_logging_contents is undefined
        - "{{ openshift_logging_es_log_appenders | list | difference(es_log_appenders) | length != 0 }}"
      changed_when: no

    - template:
        src: elasticsearch-logging.yml.j2
        dest: "{{mktemp.stdout}}/elasticsearch-logging.yml"
      vars:
        root_logger: "{{openshift_logging_es_log_appenders | join(', ')}}"
      when: es_logging_contents is undefined
      changed_when: no
      check_mode: no

    - local_action: >
        copy content="{{ config_source | combine(override_config,recursive=True) | to_nice_yaml }}"
        dest="{{local_tmp.stdout}}/elasticsearch-gen-template.yml"
      vars:
        config_source: "{{lookup('file','templates/elasticsearch.yml.j2') | from_yaml }}"
        override_config: "{{openshift_logging_es_config | from_yaml}}"
      when: es_logging_contents is undefined
      changed_when: no

    - template:
        src: "{{local_tmp.stdout}}/elasticsearch-gen-template.yml"
        dest: "{{mktemp.stdout}}/elasticsearch.yml"
      vars:
        - allow_cluster_reader: "{{openshift_logging_es_ops_allow_cluster_reader | lower | default('false')}}"
      when: es_config_contents is undefined
      changed_when: no

    - copy:
        content: "{{es_logging_contents}}"
        dest: "{{mktemp.stdout}}/elasticsearch-logging.yml"
      when: es_logging_contents is defined
      changed_when: no

    - copy:
        content: "{{es_config_contents}}"
        dest: "{{mktemp.stdout}}/elasticsearch.yml"
      when: es_config_contents is defined
      changed_when: no

    - command: >
        {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create configmap logging-elasticsearch
        --from-file=logging.yml={{mktemp.stdout}}/elasticsearch-logging.yml --from-file=elasticsearch.yml={{mktemp.stdout}}/elasticsearch.yml -o yaml --dry-run
      register: es_configmap
      changed_when: no

    - copy:
        content: "{{es_configmap.stdout}}"
        dest: "{{mktemp.stdout}}/templates/logging-elasticsearch-configmap.yaml"
      when: es_configmap.stdout is defined
      changed_when: no
  check_mode: no

- block:
    - copy:
        src: curator.yml
        dest: "{{mktemp.stdout}}/curator.yml"
      when: curator_config_contents is undefined
      changed_when: no

    - copy:
        content: "{{curator_config_contents}}"
        dest: "{{mktemp.stdout}}/curator.yml"
      when: curator_config_contents is defined
      changed_when: no

    - command: >
        {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create configmap logging-curator
        --from-file=config.yaml={{mktemp.stdout}}/curator.yml -o yaml --dry-run
      register: curator_configmap
      changed_when: no

    - copy:
        content: "{{curator_configmap.stdout}}"
        dest: "{{mktemp.stdout}}/templates/logging-curator-configmap.yaml"
      when: curator_configmap.stdout is defined
      changed_when: no
  check_mode: no

- block:
    - copy:
        src: fluent.conf
        dest: "{{mktemp.stdout}}/fluent.conf"
      when: fluentd_config_contents is undefined
      changed_when: no

    - copy:
        src: fluentd-throttle-config.yaml
        dest: "{{mktemp.stdout}}/fluentd-throttle-config.yaml"
      when: fluentd_throttle_contents is undefined
      changed_when: no

    - copy:
        src: secure-forward.conf
        dest: "{{mktemp.stdout}}/secure-forward.conf"
      when: fluentd_securefoward_contents is undefined
      changed_when: no

    - copy:
        content: "{{fluentd_config_contents}}"
        dest: "{{mktemp.stdout}}/fluent.conf"
      when: fluentd_config_contents is defined
      changed_when: no

    - copy:
        content: "{{fluentd_throttle_contents}}"
        dest: "{{mktemp.stdout}}/fluentd-throttle-config.yaml"
      when: fluentd_throttle_contents is defined
      changed_when: no

    - copy:
        content: "{{fluentd_secureforward_contents}}"
        dest: "{{mktemp.stdout}}/secure-forward.conf"
      when: fluentd_secureforward_contents is defined
      changed_when: no

    - command: >
        {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig create configmap logging-fluentd
        --from-file=fluent.conf={{mktemp.stdout}}/fluent.conf --from-file=throttle-config.yaml={{mktemp.stdout}}/fluentd-throttle-config.yaml
        --from-file=secure-forward.conf={{mktemp.stdout}}/secure-forward.conf -o yaml --dry-run
      register: fluentd_configmap
      changed_when: no

    - copy:
        content: "{{fluentd_configmap.stdout}}"
        dest: "{{mktemp.stdout}}/templates/logging-fluentd-configmap.yaml"
      when: fluentd_configmap.stdout is defined
      changed_when: no
  check_mode: no