From fc4327d946220db2a96691c955e72114fee8a850 Mon Sep 17 00:00:00 2001
From: nikparasyr <nik.parasyr@protonmail.com>
Date: Tue, 6 Oct 2020 20:43:52 +0200
Subject: [PATCH] Allow overwrite of placement-api wsgi config

Use with_first_found on placement-api-wsgi to allow
overwrite from users and keep consistency with other
roles.

Change-Id: I11c84db6df1bb5be61db5b6b0adf8c160a2bd931
Closes-Bug: #1898766
---
 ansible/roles/placement/tasks/config.yml             | 6 +++++-
 releasenotes/notes/bug-1898766-ffc55c97230d8221.yaml | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/bug-1898766-ffc55c97230d8221.yaml

diff --git a/ansible/roles/placement/tasks/config.yml b/ansible/roles/placement/tasks/config.yml
index 60d3a65622..d29f8cf051 100644
--- a/ansible/roles/placement/tasks/config.yml
+++ b/ansible/roles/placement/tasks/config.yml
@@ -73,12 +73,16 @@
   vars:
     service: "{{ placement_services['placement-api'] }}"
   template:
-    src: "placement-api-wsgi.conf.j2"
+    src: "{{ item }}"
     dest: "{{ node_config_directory }}/placement-api/placement-api-wsgi.conf"
     mode: "0660"
   when:
     - inventory_hostname in groups[service.group]
     - service.enabled | bool
+  with_first_found:
+    - "{{ node_custom_config }}/placement/{{ inventory_hostname }}/placement-api-wsgi.conf"
+    - "{{ node_custom_config }}/placement/placement-api-wsgi.conf"
+    - "placement-api-wsgi.conf.j2"
   notify:
     - Restart placement-api container
 
diff --git a/releasenotes/notes/bug-1898766-ffc55c97230d8221.yaml b/releasenotes/notes/bug-1898766-ffc55c97230d8221.yaml
new file mode 100644
index 0000000000..4a980f09fc
--- /dev/null
+++ b/releasenotes/notes/bug-1898766-ffc55c97230d8221.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Add with_first_found on placement for placement-api wsgi configuration
+    to allow overwrite from users.
+    `LP#1898766 <https://launchpad.net/bugs/1898766>`__
-- 
GitLab