
This change matches an earlier modification to os_neutron Currently we symlink /etc/<service> to empty directory at pre-stage, and filling it with config only during post_install. This means, that policies and rootwrap filters are not working properly until playbook execution finish. Additionally, we replace sudoers file with new path in it, which makes current operations impossible for the service, since rootwrap can not gain sudo privileges. With this change we move symlinking and rootwrap steps to handlers, which means that we will do replace configs while service is stopped. During post_install we place all of the configs inside the venv, which is versioned at the moment. This way we minimise downtime of the service while performing upgrades Closes-Bug: #2056180 Change-Id: I9c8212408c21e09895ee5805011aecb40b689a13
177 lines
5.2 KiB
YAML
177 lines
5.2 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# 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.
|
|
|
|
# NOTE(cloudnull) this task is not in dict formation because it is
|
|
# dynamically loading facts from the nova_virt_types based on the
|
|
# nova_virt_type setting.
|
|
- name: Set nova config facts
|
|
set_fact:
|
|
"{{ item.key }}": "{{ item.value }}" # noqa: var-naming[no-jinja]
|
|
with_dict: "{{ nova_virt_types[nova_virt_type] }}"
|
|
when:
|
|
- item.key not in hostvars[inventory_hostname] or item.key is undefined
|
|
tags:
|
|
- nova-config
|
|
- nova-post-install
|
|
|
|
# NOTE(cloudnull): This task is required to copy rootwrap filters that we need
|
|
# and nova does not provide by default.
|
|
- name: Create aux nova dir
|
|
file:
|
|
path: "{{ item.path | default(omit) }}"
|
|
state: "directory"
|
|
owner: "{{ item.owner | default(nova_system_user_name) }}"
|
|
group: "{{ item.group | default(nova_system_group_name) }}"
|
|
mode: "{{ item.mode | default(omit) }}"
|
|
with_items:
|
|
- path: "{{ nova_conf_version_dir }}/rootwrap.d"
|
|
owner: "root"
|
|
group: "root"
|
|
|
|
- name: Copy nova rootwrap filter config
|
|
copy:
|
|
src: "{{ item }}"
|
|
dest: "{{ nova_conf_version_dir }}/rootwrap.d/"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
with_fileglob:
|
|
- rootwrap.d/*
|
|
notify:
|
|
- Restart nova services
|
|
- Restart uwsgi services
|
|
tags:
|
|
- nova-config
|
|
- nova-post-install
|
|
|
|
- name: Generate nova config
|
|
openstack.config_template.config_template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: "root"
|
|
group: "{{ item.group | default(nova_system_group_name) }}"
|
|
mode: "0640"
|
|
config_overrides: "{{ item.config_overrides }}"
|
|
config_type: "{{ item.config_type }}"
|
|
yml_multilines: "{{ item.yml_multilines | default(omit) }}"
|
|
with_items:
|
|
- src: "nova.conf.j2"
|
|
dest: "{{ nova_conf_version_dir }}/nova.conf"
|
|
config_overrides: "{{ nova_nova_conf_overrides }}"
|
|
config_type: "ini"
|
|
- src: "vendor_data.json.j2"
|
|
dest: "{{ nova_conf_version_dir }}/vendor_data.json"
|
|
config_overrides: "{{ nova_vendor_data_overrides }}"
|
|
config_type: "json"
|
|
yml_multilines: True
|
|
notify:
|
|
- Restart nova services
|
|
- Restart uwsgi services
|
|
tags:
|
|
- nova-config
|
|
- nova-post-install
|
|
|
|
- name: Implement policy.yaml if there are overrides configured
|
|
openstack.config_template.config_template:
|
|
content: "{{ nova_policy_overrides }}"
|
|
dest: "{{ nova_conf_version_dir }}/policy.yaml"
|
|
owner: "root"
|
|
group: "{{ nova_system_group_name }}"
|
|
mode: "0640"
|
|
config_type: yaml
|
|
when:
|
|
- nova_policy_overrides | length > 0
|
|
tags:
|
|
- nova-config
|
|
- nova-policy-override
|
|
|
|
- name: Implement compute host provider.yaml if there are overrides configured
|
|
openstack.config_template.config_template:
|
|
content: "{{ item.content }}"
|
|
dest: "{{ nova_conf_version_dir }}/provider_config/{{ item.name }}.yaml"
|
|
owner: "root"
|
|
group: "{{ nova_system_group_name }}"
|
|
mode: "0640"
|
|
config_type: yaml
|
|
with_items:
|
|
- "{{ nova_provider_overrides }}"
|
|
when:
|
|
- nova_services['nova-compute']['group'] in group_names
|
|
tags:
|
|
- nova-config
|
|
- nova-provider-override
|
|
|
|
- name: Remove legacy policy.yaml file
|
|
file:
|
|
path: "{{ nova_conf_dir }}/policy.yaml"
|
|
state: absent
|
|
when:
|
|
- nova_policy_overrides | length == 0
|
|
tags:
|
|
- nova-config
|
|
- nova-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"
|
|
with_items: "{{ nova_core_files }}"
|
|
|
|
- name: Fetch override files
|
|
fetch:
|
|
src: "{{ item.target_f }}"
|
|
dest: "{{ item.tmp_f }}"
|
|
flat: yes
|
|
changed_when: false
|
|
run_once: true
|
|
with_items: "{{ nova_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(nova_system_group_name) }}"
|
|
mode: "0640"
|
|
config_overrides: "{{ item.config_overrides }}"
|
|
config_type: "{{ item.config_type }}"
|
|
with_items: "{{ nova_core_files }}"
|
|
notify:
|
|
- Restart nova services
|
|
- Restart uwsgi services
|
|
|
|
- name: Cleanup fetched temp files
|
|
file:
|
|
path: "{{ item.tmp_f }}"
|
|
state: absent
|
|
changed_when: false
|
|
delegate_to: localhost
|
|
run_once: true
|
|
with_items: "{{ nova_core_files }}"
|
|
|
|
- name: Remove nova-compute config
|
|
file:
|
|
path: /etc/nova/nova-compute.conf
|
|
state: absent
|
|
notify:
|
|
- Restart nova services
|
|
- Restart uwsgi services
|
|
tags:
|
|
- nova-config
|
|
- nova-post-install
|