Fix idempotency of fluentd customisations
Fix fluentd config from overwriting custom config with the same filename Closes-Bug: #1840166 Change-Id: I42c5446381033015f590901b2120950d602f847f
This commit is contained in:
parent
5c70e0a615
commit
dcaa5f0b3d
@ -37,13 +37,27 @@
|
|||||||
notify:
|
notify:
|
||||||
- "Restart {{ item.key }} container"
|
- "Restart {{ item.key }} container"
|
||||||
|
|
||||||
|
- name: Find custom fluentd input config files
|
||||||
|
local_action:
|
||||||
|
module: find
|
||||||
|
path: "{{ node_custom_config }}/fluentd/input"
|
||||||
|
pattern: "*.conf"
|
||||||
|
run_once: True
|
||||||
|
register: find_custom_fluentd_inputs
|
||||||
|
when:
|
||||||
|
- enable_fluentd | bool
|
||||||
|
|
||||||
- name: Copying over fluentd input config files
|
- name: Copying over fluentd input config files
|
||||||
|
vars:
|
||||||
|
customised_input_files: "{{ find_custom_fluentd_inputs.files | map(attribute='path') | map('basename') | list }}"
|
||||||
template:
|
template:
|
||||||
src: "conf/input/{{ item }}.conf.j2"
|
src: "conf/input/{{ item }}.conf.j2"
|
||||||
dest: "{{ node_config_directory }}/fluentd/input/{{ item }}.conf"
|
dest: "{{ node_config_directory }}/fluentd/input/{{ item }}.conf"
|
||||||
mode: "0660"
|
mode: "0660"
|
||||||
become: true
|
become: true
|
||||||
when: enable_fluentd | bool
|
when:
|
||||||
|
- enable_fluentd | bool
|
||||||
|
- item ~ '.conf' not in customised_input_files
|
||||||
with_items:
|
with_items:
|
||||||
- "00-global"
|
- "00-global"
|
||||||
- "01-syslog"
|
- "01-syslog"
|
||||||
@ -58,16 +72,6 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart fluentd container
|
- Restart fluentd container
|
||||||
|
|
||||||
- name: Find custom fluentd input config files
|
|
||||||
local_action:
|
|
||||||
module: find
|
|
||||||
path: "{{ node_custom_config }}/fluentd/input"
|
|
||||||
pattern: "*.conf"
|
|
||||||
run_once: True
|
|
||||||
register: find_custom_fluentd_inputs
|
|
||||||
when:
|
|
||||||
- enable_fluentd | bool
|
|
||||||
|
|
||||||
- name: Copying over custom fluentd input config files
|
- name: Copying over custom fluentd input config files
|
||||||
template:
|
template:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
@ -85,7 +89,19 @@
|
|||||||
( elasticsearch_address != kolla_internal_vip_address )) and
|
( elasticsearch_address != kolla_internal_vip_address )) and
|
||||||
not enable_monasca | bool }}"
|
not enable_monasca | bool }}"
|
||||||
|
|
||||||
|
- name: Find custom fluentd output config files
|
||||||
|
local_action:
|
||||||
|
module: find
|
||||||
|
path: "{{ node_custom_config }}/fluentd/output"
|
||||||
|
pattern: "*.conf"
|
||||||
|
run_once: True
|
||||||
|
register: find_custom_fluentd_outputs
|
||||||
|
when:
|
||||||
|
- enable_fluentd | bool
|
||||||
|
|
||||||
- name: Copying over fluentd output config files
|
- name: Copying over fluentd output config files
|
||||||
|
vars:
|
||||||
|
customised_output_files: "{{ find_custom_fluentd_outputs.files | map(attribute='path') | map('basename') | list }}"
|
||||||
template:
|
template:
|
||||||
src: "conf/output/{{ item.name }}.conf.j2"
|
src: "conf/output/{{ item.name }}.conf.j2"
|
||||||
dest: "{{ node_config_directory }}/fluentd/output/{{ item.name }}.conf"
|
dest: "{{ node_config_directory }}/fluentd/output/{{ item.name }}.conf"
|
||||||
@ -94,6 +110,7 @@
|
|||||||
when:
|
when:
|
||||||
- enable_fluentd | bool
|
- enable_fluentd | bool
|
||||||
- item.enabled | bool
|
- item.enabled | bool
|
||||||
|
- item.name ~ '.conf' not in customised_output_files
|
||||||
with_items:
|
with_items:
|
||||||
- name: "00-local"
|
- name: "00-local"
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -120,16 +137,6 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart fluentd container
|
- Restart fluentd container
|
||||||
|
|
||||||
- name: Find custom fluentd output config files
|
|
||||||
local_action:
|
|
||||||
module: find
|
|
||||||
path: "{{ node_custom_config }}/fluentd/output"
|
|
||||||
pattern: "*.conf"
|
|
||||||
run_once: True
|
|
||||||
register: find_custom_fluentd_outputs
|
|
||||||
when:
|
|
||||||
- enable_fluentd | bool
|
|
||||||
|
|
||||||
- name: Copying over custom fluentd output config files
|
- name: Copying over custom fluentd output config files
|
||||||
template:
|
template:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
@ -142,19 +149,6 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart fluentd container
|
- Restart fluentd container
|
||||||
|
|
||||||
- name: Copying over fluentd format config files
|
|
||||||
template:
|
|
||||||
src: "conf/format/{{ item }}.conf.j2"
|
|
||||||
dest: "{{ node_config_directory }}/fluentd/format/{{ item }}.conf"
|
|
||||||
mode: "0660"
|
|
||||||
become: true
|
|
||||||
with_items:
|
|
||||||
- "apache_access"
|
|
||||||
- "wsgi_access"
|
|
||||||
when: enable_fluentd | bool
|
|
||||||
notify:
|
|
||||||
- Restart fluentd container
|
|
||||||
|
|
||||||
- name: Find custom fluentd format config files
|
- name: Find custom fluentd format config files
|
||||||
local_action:
|
local_action:
|
||||||
module: find
|
module: find
|
||||||
@ -165,6 +159,23 @@
|
|||||||
when:
|
when:
|
||||||
- enable_fluentd | bool
|
- enable_fluentd | bool
|
||||||
|
|
||||||
|
- name: Copying over fluentd format config files
|
||||||
|
vars:
|
||||||
|
customised_format_files: "{{ find_custom_fluentd_format.files | map(attribute='path') | map('basename') | list }}"
|
||||||
|
template:
|
||||||
|
src: "conf/format/{{ item }}.conf.j2"
|
||||||
|
dest: "{{ node_config_directory }}/fluentd/format/{{ item }}.conf"
|
||||||
|
mode: "0660"
|
||||||
|
become: true
|
||||||
|
with_items:
|
||||||
|
- "apache_access"
|
||||||
|
- "wsgi_access"
|
||||||
|
when:
|
||||||
|
- enable_fluentd | bool
|
||||||
|
- item ~ '.conf' not in customised_format_files
|
||||||
|
notify:
|
||||||
|
- Restart fluentd container
|
||||||
|
|
||||||
- name: Copying over custom fluentd format config files
|
- name: Copying over custom fluentd format config files
|
||||||
template:
|
template:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
@ -176,7 +187,18 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart fluentd container
|
- Restart fluentd container
|
||||||
|
|
||||||
|
- name: Find custom fluentd filter config files
|
||||||
|
local_action:
|
||||||
|
module: find
|
||||||
|
path: "{{ node_custom_config }}/fluentd/filter"
|
||||||
|
pattern: "*.conf"
|
||||||
|
run_once: True
|
||||||
|
register: find_custom_fluentd_filters
|
||||||
|
when: enable_fluentd | bool
|
||||||
|
|
||||||
- name: Copying over fluentd filter config files
|
- name: Copying over fluentd filter config files
|
||||||
|
vars:
|
||||||
|
customised_filter_files: "{{ find_custom_fluentd_filters.files | map(attribute='path') | map('basename') | list }}"
|
||||||
template:
|
template:
|
||||||
src: "conf/filter/{{ item.src }}.conf.j2"
|
src: "conf/filter/{{ item.src }}.conf.j2"
|
||||||
dest: "{{ node_config_directory }}/fluentd/filter/{{ item.dest }}.conf"
|
dest: "{{ node_config_directory }}/fluentd/filter/{{ item.dest }}.conf"
|
||||||
@ -187,19 +209,12 @@
|
|||||||
dest: 00-record_transformer
|
dest: 00-record_transformer
|
||||||
- src: "{{ '01-rewrite-0.14' if kolla_base_distro in ['debian', 'ubuntu'] else '01-rewrite-0.12' }}"
|
- src: "{{ '01-rewrite-0.14' if kolla_base_distro in ['debian', 'ubuntu'] else '01-rewrite-0.12' }}"
|
||||||
dest: 01-rewrite
|
dest: 01-rewrite
|
||||||
when: enable_fluentd | bool
|
when:
|
||||||
|
- enable_fluentd | bool
|
||||||
|
- item.src ~ '.conf' not in customised_filter_files
|
||||||
notify:
|
notify:
|
||||||
- Restart fluentd container
|
- Restart fluentd container
|
||||||
|
|
||||||
- name: Find custom fluentd filter config files
|
|
||||||
local_action:
|
|
||||||
module: find
|
|
||||||
path: "{{ node_custom_config }}/fluentd/filter"
|
|
||||||
pattern: "*.conf"
|
|
||||||
run_once: True
|
|
||||||
register: find_custom_fluentd_filters
|
|
||||||
when: enable_fluentd | bool
|
|
||||||
|
|
||||||
- name: Copying over custom fluentd filter config files
|
- name: Copying over custom fluentd filter config files
|
||||||
template:
|
template:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user