Allow to override placement policy files

We implement `placement_policy_overrides` variable in order to allow
management of placement policy files when needed.

Change-Id: If219ac80ceed2bf455a7de83b848c9d0a66371a4
This commit is contained in:
Dmitriy Rabotyagov 2021-03-22 19:31:25 +02:00 committed by Jonathan Rosser
parent 585aa86dbb
commit 0dfcbc27ec
3 changed files with 25 additions and 0 deletions

View File

@ -118,3 +118,4 @@ placement_services:
placement_api_uwsgi_ini_overrides: {}
placement_api_init_overrides: {}
placement_placement_conf_overrides: {}
placement_policy_overrides: {}

View File

@ -0,0 +1,5 @@
---
features:
- |
Added variable ``placement_policy_overrides`` that aims to allow deploying
policy.yaml file with provided overrides for Placement service.

View File

@ -30,3 +30,22 @@
notify:
- Restart placement services
- Restart uwsgi services
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ placement_policy_overrides }}"
dest: "/etc/placement/policy.yaml"
config_type: yaml
when:
- placement_policy_overrides | length > 0
tags:
- placement-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/placement/policy.yaml"
state: absent
when:
- placement_policy_overrides | length == 0
tags:
- placement-policy-override