bifrost/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml
Julia Kreger c1f9beac63 Initial support for installation of ironic-inspector
This review adds the ironic-inspector as a component that can be
opted to be installed by the user.  Note, this is moderately useless
without shade support and modules to assist the users to leverage
this workflow.

If a user wishes to utilize at this time before those items exist
then they will have to move nodes in available state back to
manageable state, and then invoke the inspect state which will
return them to manageable state once done.

Change-Id: I7b4ff92fa27578a9a7b0f25fc6e8658c3f2700aa
implements: blueprint bifrost-inspector-support
Depends-On: I27caa1122a72ac655958b7a6aa14b7566964f998
2015-12-01 16:08:55 -05:00

87 lines
3.0 KiB
YAML

# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: "Inspector - PIP Install"
pip:
name=ironic-inspector
state=latest
- name: "Inspector - PIP client install"
pip:
name=python-ironic-inspector-client
state=latest
# Note(TheJulia): Until support exists in the inspector database schema, to
# allow for inspector to define its preferred database engine, MySQL cannot
# be used with the default engine in the OpenStack CI.
# See: https://bugs.launchpad.net/ironic-inspector/+bug/1506160
#- name: "MySQL - Create database"
# mysql_db:
# login_user={{ mysql_username }}
# login_password={{ mysql_password }}
# name=inspector
# state=present
# encoding=utf8
# register: test_created_inspector_db
#- name: "MySQL - Create user for inspector"
# mysql_user:
# login_user={{ mysql_username }}
# login_password={{ mysql_password }}
# name=inspector
# password={{ ironic_db_password }}
# priv=inspector.*:ALL
# state=present
- name: "Inspector - Ensure /etc/ironic-inspector/ exists"
file:
dest=/etc/ironic-inspector
owner=ironic
group=ironic
mode=0755
state=directory
- name: "Inspector - Place Configuration"
template:
src=ironic-inspector.conf.j2
dest=/etc/ironic-inspector/inspector.conf
owner=ironic
group=ironic
mode=0740
- name: "Inspector - create data folder"
file:
name="{{ inspector_data_dir }}"
state=directory
owner=ironic
group=ironic
mode=0755
- name: "Inspector - create log folder"
file:
name="{{ inspector_data_dir }}/log"
state=directory
owner=ironic
group=ironic
mode=0755
- name: "Upgrade inspector DB Schema"
command: su ironic -c "ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade"
- name: "Inspector - Get ironic-inspector install location"
shell: echo $(dirname $(which ironic-inspector))
register: ironic_install_prefix
- name: "Inspector - Place service"
template: src={{ init_template }} dest={{ init_dest_dir }}{{item.service_name}}{{ init_ext }} owner=root group=root
with_items:
- { service_path: "{{ ironic_install_prefix.stdout }}", service_name: 'ironic-inspector', username: 'ironic', args: '--config-file /etc/ironic-inspector/inspector.conf'}
- name: "Inspector - Explicitly permit TCP/5050 for ironic-inspector callback"
command: iptables -I INPUT -p tcp --dport 5050 -i {{network_interface}} -j ACCEPT
- name: "Inspector - (re)starting ironic-inspector service"
service:
name=ironic-inspector
state=restarted