diff --git a/ansible/roles/common/templates/conf/output/00-local.conf.j2 b/ansible/roles/common/templates/conf/output/00-local.conf.j2
index adfa7ff4df..ba46b519bd 100644
--- a/ansible/roles/common/templates/conf/output/00-local.conf.j2
+++ b/ansible/roles/common/templates/conf/output/00-local.conf.j2
@@ -1,3 +1,4 @@
+{% if enable_swift | bool and (inventory_hostname in groups['swift-proxy-server'] or inventory_hostname in groups['swift-account-server'] or inventory_hostname in groups['swift-container-server'] or inventory_hostname in groups['swift-object-server']) %}
@type copy
@@ -58,7 +59,9 @@
{% endif %}
+{% endif %}
+{% if enable_haproxy | bool and inventory_hostname in groups['loadbalancer'] %}
@type copy
@@ -121,6 +124,7 @@
{% endif %}
+{% endif %}
{% if glance_enable_tls_backend | bool %}
diff --git a/ansible/roles/common/templates/fluentd.json.j2 b/ansible/roles/common/templates/fluentd.json.j2
index 8ca82bf130..0df04b1aad 100644
--- a/ansible/roles/common/templates/fluentd.json.j2
+++ b/ansible/roles/common/templates/fluentd.json.j2
@@ -29,11 +29,13 @@
"owner": "{{ fluentd_user }}:{{ fluentd_user }}",
"recurse": true
},
+{% if enable_haproxy | bool and inventory_hostname in groups['loadbalancer'] %}
{
"path": "/var/log/kolla/haproxy",
"owner": "{{ fluentd_user }}:{{ fluentd_user }}",
"recurse": true
},
+{% endif %}
{% if glance_enable_tls_backend | bool %}
{
"path": "/var/log/kolla/glance-tls-proxy",
@@ -48,11 +50,13 @@
"recurse": true
},
{% endif %}
+{% if enable_swift | bool and (inventory_hostname in groups['swift-proxy-server'] or inventory_hostname in groups['swift-account-server'] or inventory_hostname in groups['swift-container-server'] or inventory_hostname in groups['swift-object-server']) %}
{
"path": "/var/log/kolla/swift",
"owner": "{{ fluentd_user }}:{{ fluentd_user }}",
"recurse": true
},
+{% endif %}
{
"path": "/var/lib/fluentd/data",
"owner": "{{ fluentd_user }}:{{ fluentd_user }}",
diff --git a/releasenotes/notes/bug-1945070-965635387a8581f9.yaml b/releasenotes/notes/bug-1945070-965635387a8581f9.yaml
new file mode 100644
index 0000000000..1c1728b416
--- /dev/null
+++ b/releasenotes/notes/bug-1945070-965635387a8581f9.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ No longer creates directories for haproxy and swift logs where they
+ are not needed.
+ `LP#1945070 `__