openstack-ansible-os_ironic/tasks/ironic_post_install.yml
Jesse Pretorius b5d7b7986c Implement initial test inventory/plays
This patch implements an initial set of inventory and playbooks
which results in the successful convergence of a standalone
build of Ironic.

It also adds the rootwrap filters, implement config_template
for all the conf files appropriately and ensures that the sudoers
is implemented in the right order of execution.

All content is based from the head of stable/mitaka on
24 Mar 2016.

Change-Id: I9182951c394a8c52826480aba7bc7e4d437988c5
2016-03-24 23:58:05 +00:00

106 lines
3.6 KiB
YAML

---
# Copyright 2015, 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.
- name: Setup ironic for standalone usage
set_fact:
ironic_driver_list: "{{ ironic_standalone_driver_list }}"
ironic_auth_strategy: "{{ ironic_standalone_auth_strategy }}"
ironic_api_url: "{{ ironic_standalone_api_url }}"
ironic_dhcp_provider: "{{ ironic_standalone_dhcp_provider }}"
ironic_sync_power_state_interval: "{{ ironic_standalone_sync_power_state_interval }}"
ironic_db_connection_string: "{{ ironic_standalone_db_connection_string }}"
when: ironic_standalone
- name: Setup ironic for integrated Openstack usage
set_fact:
ironic_driver_list: "{{ ironic_openstack_driver_list }}"
ironic_auth_strategy: "{{ ironic_openstack_auth_strategy }}"
ironic_api_url: "{{ ironic_openstack_api_url }}"
ironic_dhcp_provider: "{{ ironic_openstack_dhcp_provider }}"
ironic_sync_power_state_interval: "{{ ironic_openstack_sync_power_state_interval }}"
ironic_db_connection_string: "{{ ironic_openstack_db_connection_string }}"
when: not ironic_standalone
- name: Get ironic command path
command: which ironic
register: ironic_command_path
when:
- not ironic_venv_enabled | bool
tags:
- ironic-command-bin
- name: Set ironic command path
set_fact:
ironic_bin: "{{ ironic_command_path.stdout | dirname }}"
when:
- not ironic_venv_enabled | bool
tags:
- ironic-command-bin
- name: Generate ironic config
config_template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner|default(ironic_system_user_name) }}"
group: "{{ item.group|default(ironic_system_group_name) }}"
mode: "0644"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
with_items:
- src: "ironic.conf.j2"
dest: "/etc/ironic/ironic.conf"
config_overrides: "{{ ironic_ironic_conf_overrides }}"
config_type: "ini"
- src: "rootwrap.conf.j2"
dest: "/etc/ironic/rootwrap.conf"
owner: "root"
group: "root"
config_overrides: "{{ ironic_rootwrap_conf_overrides }}"
config_type: "ini"
- src: "policy.json.j2"
dest: "/etc/ironic/policy.json"
config_overrides: "{{ ironic_policy_overrides }}"
config_type: "json"
notify: Restart ironic services
tags:
- ironic-config
- ironic-post-install
- name: Copy ironic rootwrap filter config
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "root"
with_items:
- { src: "rootwrap.d/ironic-images.filters", dest: "/etc/ironic/rootwrap.d/ironic-images.filters" }
- { src: "rootwrap.d/ironic-lib.filters", dest: "/etc/ironic/rootwrap.d/ironic-lib.filters" }
- { src: "rootwrap.d/ironic-utils.filters", dest: "/etc/ironic/rootwrap.d/ironic-utils.filters" }
notify: Restart ironic services
tags:
- ironic-config
- ironic-post-install
- name: Include sudoers file
template:
src: "sudoers.j2"
dest: "/etc/sudoers.d/{{ ironic_system_user_name }}_sudoers"
mode: "0440"
owner: "root"
group: "root"
tags:
- ironic-api
- ironic-conductor