From 0dfcbc27ecb07db6664b3bb00e1630af4edb02c4 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 22 Mar 2021 19:31:25 +0200 Subject: [PATCH] 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 --- defaults/main.yml | 1 + ...ent_policy_overrides-42fec8e157795d27.yaml | 5 +++++ tasks/placement_post_install.yml | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 releasenotes/notes/osa/placement_policy_overrides-42fec8e157795d27.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 05016a9..b257390 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -118,3 +118,4 @@ placement_services: placement_api_uwsgi_ini_overrides: {} placement_api_init_overrides: {} placement_placement_conf_overrides: {} +placement_policy_overrides: {} diff --git a/releasenotes/notes/osa/placement_policy_overrides-42fec8e157795d27.yaml b/releasenotes/notes/osa/placement_policy_overrides-42fec8e157795d27.yaml new file mode 100644 index 0000000..e8f6a82 --- /dev/null +++ b/releasenotes/notes/osa/placement_policy_overrides-42fec8e157795d27.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added variable ``placement_policy_overrides`` that aims to allow deploying + policy.yaml file with provided overrides for Placement service. diff --git a/tasks/placement_post_install.yml b/tasks/placement_post_install.yml index 340ec1a..636e989 100644 --- a/tasks/placement_post_install.yml +++ b/tasks/placement_post_install.yml @@ -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