openstack-ansible-os_nova/tasks/nova_post_install.yml
Michael Davies e2fc4b7b96 Add Nova config for os_ironic role
This patch configures Nova for use with Ironic, noting that
without moving to cells, an openstack-ansible install can support
only one type of hypervisor at a time (i.e. kvm or ironic etc).
Setting the nova_virt_type determines whether Nova is configured
for Ironic. If it is left unset, the default kvm hypervisor
is used.

The nova virtualization types have all been moved into a single
nova_virt_types data structure which is used to define facts
for a specific supported virtualization type. This change is
compatible with older versions of overrides as the virt type
values are used to set host facts which could also be set
using user variables or any other means to predefine a default
value.

Change-Id: Ic8160fa00457d68ee223452f4dae6d38bffcdca0
Signed-off-by: Michael Davies <michael@the-davies.net>
Partially-implements: blueprint role-ironic
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-04-11 07:06:07 +00:00

104 lines
3.3 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 }}"'
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
- name: Generate nova config
config_template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner|default(nova_system_user_name) }}"
group: "{{ item.group|default(nova_system_group_name) }}"
mode: "0644"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
with_items:
- src: "nova.conf.j2"
dest: "/etc/nova/nova.conf"
config_overrides: "{{ nova_nova_conf_overrides }}"
config_type: "ini"
- src: "rootwrap.conf.j2"
dest: "/etc/nova/rootwrap.conf"
owner: "root"
group: "root"
config_overrides: "{{ nova_rootwrap_conf_overrides }}"
config_type: "ini"
- src: "api-paste.ini.j2"
dest: "/etc/nova/api-paste.ini"
config_overrides: "{{ nova_api_paste_ini_overrides }}"
config_type: "ini"
- src: "policy.json.j2"
dest: "/etc/nova/policy.json"
config_overrides: "{{ nova_policy_overrides }}"
config_type: "json"
notify: Restart nova services
tags:
- nova-config
- nova-post-install
- name: Copy nova rootwrap filter config
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "root"
with_items:
- { src: "rootwrap.d/api-metadata.filters", dest: "/etc/nova/rootwrap.d/api-metadata.filters" }
- { src: "rootwrap.d/baremetal-compute-ipmi.filters", dest: "/etc/nova/rootwrap.d/baremetal-compute-ipmi.filters" }
- { src: "rootwrap.d/baremetal-deploy-helper.filters", dest: "/etc/nova/rootwrap.d/baremetal-deploy-helper.filters" }
- { src: "rootwrap.d/compute.filters", dest: "/etc/nova/rootwrap.d/compute.filters" }
- { src: "rootwrap.d/network.filters", dest: "/etc/nova/rootwrap.d/network.filters" }
notify: Restart nova services
tags:
- nova-config
- nova-post-install
- name: Get nova command path
command: which nova
register: nova_command_path
when:
- not nova_venv_enabled | bool
tags:
- nova-command-bin
- name: Set nova command path
set_fact:
nova_bin: "{{ nova_command_path.stdout | dirname }}"
when:
- not nova_venv_enabled | bool
tags:
- nova-command-bin
- name: Drop sudoers file
template:
src: "sudoers.j2"
dest: "/etc/sudoers.d/{{ nova_system_user_name }}_sudoers"
mode: "0440"
owner: "root"
group: "root"
tags:
- sudoers
- nova-sudoers