openstack-ansible-os_senlin/tasks/senlin_post_install.yml

97 lines
2.8 KiB
YAML

---
# Copyright 2020, Satish Patel <satish.lx@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Drop senlin Config(s)
openstack.config_template.config_template:
src: "senlin.conf.j2"
dest: "/etc/senlin/senlin.conf"
owner: "root"
group: "{{ senlin_system_group_name }}"
mode: "0640"
config_overrides: "{{ senlin_senlin_conf_overrides }}"
config_type: "ini"
notify:
- Restart senlin services
- name: Implement policy.yaml if there are overrides configured
openstack.config_template.config_template:
content: "{{ senlin_policy_overrides }}"
dest: "/etc/senlin/policy.yaml"
owner: "root"
group: "{{ senlin_system_group_name }}"
mode: "0640"
config_type: yaml
when:
- senlin_policy_overrides | length > 0
tags:
- senlin-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/senlin/policy.yaml"
state: absent
when:
- senlin_policy_overrides | length == 0
tags:
- senlin-policy-override
# NOTE(cloudnull): This is using "cp" instead of copy with a remote_source
# because we only want to copy the original files once. and we
# don't want to need multiple tasks.
- name: Preserve original configuration file(s)
command: "cp {{ item.target_f }} {{ item.target_f }}.original"
args:
creates: "{{ item.target_f }}.original"
when:
- item.condition | bool
with_items: "{{ senlin_core_files }}"
- name: Fetch override files
fetch:
src: "{{ item.target_f }}"
dest: "{{ item.tmp_f }}"
flat: yes
changed_when: false
run_once: true
when:
- item.condition | bool
with_items: "{{ senlin_core_files }}"
- name: Copy common config
openstack.config_template.config_template:
src: "{{ item.tmp_f }}"
dest: "{{ item.target_f }}"
owner: "root"
group: "{{ item.group | default(senlin_system_group_name) }}"
mode: "0640"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
when:
- item.condition | bool
with_items: "{{ senlin_core_files }}"
notify:
- Restart uwsgi services
- Restart senlin services
- name: Cleanup fetched temp files
file:
path: "{{ item.tmp_f }}"
state: absent
changed_when: false
delegate_to: localhost
when:
- item.condition | bool
with_items: "{{ senlin_core_files }}"