Add apache to front ironic-api
Additionally fix some tasks that were only running on host [0] but should be running on all hosts.
This commit is contained in:
parent
26df6924ae
commit
44348869cf
@ -38,7 +38,7 @@ ironic_system_home_folder: "/var/lib/{{ ironic_system_user_name }}"
|
|||||||
ironic_system_log_folder: "/var/log/{{ ironic_system_user_name }}"
|
ironic_system_log_folder: "/var/log/{{ ironic_system_user_name }}"
|
||||||
|
|
||||||
# Ironic Program and Service names
|
# Ironic Program and Service names
|
||||||
ironic_api_program_name: ironic-api
|
ironic_api_program_name: apache2
|
||||||
ironic_conductor_program_name: ironic-conductor
|
ironic_conductor_program_name: ironic-conductor
|
||||||
python_ironic_client_program_name: ironic
|
python_ironic_client_program_name: ironic
|
||||||
ironic_service_names:
|
ironic_service_names:
|
||||||
@ -120,6 +120,14 @@ ironic_pip_packages:
|
|||||||
- mysql-python
|
- mysql-python
|
||||||
- ironic
|
- ironic
|
||||||
|
|
||||||
|
ironic_api_apt_packages:
|
||||||
|
- apache2
|
||||||
|
- apache2-utils
|
||||||
|
- libapache2-mod-wsgi
|
||||||
|
|
||||||
|
ironic_api_pip_packages:
|
||||||
|
- mysql-python
|
||||||
|
|
||||||
python_ironicclient_pip_packages:
|
python_ironicclient_pip_packages:
|
||||||
- python_ironicclient
|
- python_ironicclient
|
||||||
|
|
||||||
@ -149,4 +157,6 @@ ironic_rabbitmq_password: ch4rl0tt3 # TODO(mrda): Manage secrets
|
|||||||
ironic_service_user_name: "ironic"
|
ironic_service_user_name: "ironic"
|
||||||
ironic_service_password: "4nn3" # TODO(mrda): Manage secrets
|
ironic_service_password: "4nn3" # TODO(mrda): Manage secrets
|
||||||
|
|
||||||
|
# Apache settings
|
||||||
|
ironic_wsgi_threads: 1
|
||||||
|
ironic_wsgi_processes: "{{ ansible_processor_vcpus | default (1) * 2 }}"
|
||||||
|
43
tasks/ironic_api_install.yml
Normal file
43
tasks/ironic_api_install.yml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
# 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: Install ironic-api specific apt packages
|
||||||
|
apt:
|
||||||
|
pkg: "{{ item }}"
|
||||||
|
state: latest
|
||||||
|
register: install_packages
|
||||||
|
until: install_packages|success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
with_items: ironic_api_apt_packages
|
||||||
|
tags:
|
||||||
|
- ironic-install
|
||||||
|
- ironic-api
|
||||||
|
- ironic-apt-packages
|
||||||
|
|
||||||
|
- name: Install ironic-api specific pip dependencies
|
||||||
|
pip:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
extra_args: "{{ pip_install_options|default('') }}"
|
||||||
|
register: install_packages
|
||||||
|
until: install_packages|success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
with_items: ironic_api_pip_packages
|
||||||
|
tags:
|
||||||
|
- ironic-install
|
||||||
|
- ironic-api
|
||||||
|
- ironic-pip-packages
|
61
tasks/ironic_api_post_install.yml
Normal file
61
tasks/ironic_api_post_install.yml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
- name: Setup Ironic Apache site conf
|
||||||
|
template:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
|
with_items:
|
||||||
|
- { src: "ironic-ports.conf.j2", dest: "/etc/apache2/ports.conf" }
|
||||||
|
- { src: "ironic-httpd.conf.j2", dest: "/etc/apache2/sites-available/ironic-httpd.conf" }
|
||||||
|
notify:
|
||||||
|
- Restart Apache
|
||||||
|
tags:
|
||||||
|
- ironic-httpd
|
||||||
|
|
||||||
|
- name: Disable default apache site
|
||||||
|
file:
|
||||||
|
path: "/etc/apache2/sites-enabled/000-default.conf"
|
||||||
|
state: "absent"
|
||||||
|
notify:
|
||||||
|
- Restart Apache
|
||||||
|
tags:
|
||||||
|
- ironic-httpd
|
||||||
|
|
||||||
|
- name: Enable ironic vhost
|
||||||
|
file:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
state: "{{ item.state }}"
|
||||||
|
with_items:
|
||||||
|
- { src: "/etc/apache2/sites-available/ironic-httpd.conf", dest: "/etc/apache2/sites-enabled/ironic-httpd.conf", state: "link" }
|
||||||
|
notify:
|
||||||
|
- Restart Apache
|
||||||
|
tags:
|
||||||
|
- ironic-httpd
|
||||||
|
|
||||||
|
- name: Setup Ironic WSGI Configs
|
||||||
|
template:
|
||||||
|
src: "ironic-wsgi.py.j2"
|
||||||
|
dest: "/var/www/cgi-bin/ironic/ironic.wsgi"
|
||||||
|
owner: "{{ ironic_system_user_name }}"
|
||||||
|
group: "{{ ironic_system_group_name }}"
|
||||||
|
mode: "0755"
|
||||||
|
notify:
|
||||||
|
- Restart Apache
|
||||||
|
tags:
|
||||||
|
- ironic-config
|
@ -13,14 +13,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- include: ironic_upstart_common_init.yml
|
#- include: ironic_upstart_common_init.yml
|
||||||
vars:
|
# vars:
|
||||||
program_name: "{{ ironic_api_program_name }}"
|
# program_name: "{{ ironic_api_program_name }}"
|
||||||
service_name: "{{ ironic_service_name }}"
|
# service_name: "{{ ironic_service_name }}"
|
||||||
system_user: "{{ ironic_system_user_name }}"
|
# system_user: "{{ ironic_system_user_name }}"
|
||||||
system_group: "{{ ironic_system_group_name }}"
|
# system_group: "{{ ironic_system_group_name }}"
|
||||||
service_home: "{{ ironic_system_home_folder }}"
|
# service_home: "{{ ironic_system_home_folder }}"
|
||||||
when: inventory_hostname in groups['ironic_api']
|
# when: inventory_hostname in groups['ironic_api']
|
||||||
|
|
||||||
- include: ironic_upstart_common_init.yml
|
- include: ironic_upstart_common_init.yml
|
||||||
vars:
|
vars:
|
||||||
|
@ -16,18 +16,26 @@
|
|||||||
- include: ironic_pre_install.yml
|
- include: ironic_pre_install.yml
|
||||||
- include: ironic_install.yml
|
- include: ironic_install.yml
|
||||||
|
|
||||||
|
- include: ironic_api_install.yml
|
||||||
|
when: >
|
||||||
|
inventory_hostname in groups['ironic_api']
|
||||||
|
|
||||||
- include: ironic_conductor_install.yml
|
- include: ironic_conductor_install.yml
|
||||||
when: >
|
when: >
|
||||||
inventory_hostname == groups['ironic_conductor'][0]
|
inventory_hostname in groups['ironic_conductor']
|
||||||
|
|
||||||
- include: python_ironicclient_install.yml
|
- include: python_ironicclient_install.yml
|
||||||
|
|
||||||
- include: ironic_post_install.yml
|
- include: ironic_post_install.yml
|
||||||
|
|
||||||
|
- include: ironic_api_post_install.yml
|
||||||
|
when: >
|
||||||
|
inventory_hostname in groups['ironic_api']
|
||||||
|
|
||||||
- include: ironic_conductor_post_install.yml
|
- include: ironic_conductor_post_install.yml
|
||||||
when: >
|
when: >
|
||||||
inventory_hostname == groups['ironic_conductor'][0]
|
inventory_hostname in groups['ironic_conductor']
|
||||||
|
|
||||||
- include: ironic_db_setup.yml
|
- include: ironic_db_setup.yml
|
||||||
when: >
|
when: >
|
||||||
inventory_hostname == groups['ironic_conductor'][0]
|
inventory_hostname == groups['ironic_conductor'][0]
|
||||||
|
20
templates/ironic-httpd.conf.j2
Normal file
20
templates/ironic-httpd.conf.j2
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
<VirtualHost *:{{ ironic_service_port }}>
|
||||||
|
WSGIDaemonProcess ironic-api user={{ ironic_system_user_name }} group={{ ironic_group_name }} processes={{ ironic_wsgi_processes }} threads={{ ironic_wsgi_threads }} display-name=%{GROUP}
|
||||||
|
WSGIScriptAlias / /var/www/cgi-bin/ironic/ironic.wsgi
|
||||||
|
SetEnv APACHE_RUN_USER {{ ironic_system_user_name }}
|
||||||
|
SetEnv APACHE_RUN_GROUP {{ ironic_system_group_name }}
|
||||||
|
WSGIProcessGroup ironic-api
|
||||||
|
|
||||||
|
ErrorLog /var/log/ironic/ironic_error.log
|
||||||
|
LogLevel info
|
||||||
|
CustomLog /var/log/ironic/ironic_access.log combined
|
||||||
|
|
||||||
|
<Directory /var/www/cgi-bin/ironic/>
|
||||||
|
WSGIProcessGroup ironic-api
|
||||||
|
WSGIApplicationGroup %{GLOBAL}
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
3
templates/ironic-ports.conf.j2
Normal file
3
templates/ironic-ports.conf.j2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
Listen {{ ironic_service_port }}
|
47
templates/ironic-wsgi.py.j2
Normal file
47
templates/ironic-wsgi.py.j2
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#"""
|
||||||
|
#Use this file for deploying the API service under Apache2 mod_wsgi.
|
||||||
|
#"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
{% if ironic_venv_enable | bool %}
|
||||||
|
activate_this = os.path.expanduser("{{ ironic_venv_bin }}/activate_this.py")
|
||||||
|
execfile(activate_this, dict(__file__=activate_this))
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
import oslo_i18n as i18n
|
||||||
|
from oslo_log import log
|
||||||
|
|
||||||
|
from ironic.api import app
|
||||||
|
from ironic.common import service
|
||||||
|
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
i18n.install('ironic')
|
||||||
|
|
||||||
|
service.prepare_service(sys.argv)
|
||||||
|
|
||||||
|
LOG = log.getLogger(__name__)
|
||||||
|
LOG.debug("Configuration:")
|
||||||
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||||
|
|
||||||
|
application = app.VersionSelectorApplication()
|
Loading…
x
Reference in New Issue
Block a user