
apache with mod_wsgi takes care of starting the app. If the role is first ran with the defaults, the ara systemd service will be running. If we re-run the role and choose an apache deployment, we need to make sure we're disabling it. What this boils down to -- let's always set up the systemd service but start it or disable it according to what we need to deploy. Change-Id: I8fceed417d766a28564ad88a972de4f38c1b44ac
60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
---
|
|
# Copyright (c) 2018 Red Hat, Inc.
|
|
#
|
|
# This file is part of ARA Records Ansible.
|
|
#
|
|
# ARA is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# ARA is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# We're setting ara.host to localhost, there's no point in making the web
|
|
# application listen on 0.0.0.0 or other things since it'll be proxied by nginx
|
|
- name: Override ARA host when reverse proxying
|
|
vars:
|
|
override:
|
|
config:
|
|
host: 127.0.0.1
|
|
proxy_host: "{{ ara.config.host }}"
|
|
proxy_port: 80
|
|
set_fact:
|
|
ara: "{{ ara | combine(override, recursive=true) }}"
|
|
|
|
- name: Ensure the embedded server service is running
|
|
include_tasks: ../embedded/standalone.yml
|
|
|
|
- name: Set selinux boolean to allow nginx to reverse proxy
|
|
become: yes
|
|
seboolean:
|
|
name: httpd_can_network_connect
|
|
state: yes
|
|
persistent: yes
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
- name: Install nginx
|
|
include_tasks: install.yml
|
|
|
|
- name: Set up the nginx configuration
|
|
template:
|
|
src: nginx_embedded_proxy.conf.j2
|
|
dest: "{{ nginx_config_path }}/ara.conf"
|
|
notify:
|
|
- restart nginx
|
|
|
|
- name: Enable the nginx configuration on Debian-like systems
|
|
file:
|
|
src: "{{ nginx_config_path }}/ara.conf"
|
|
dest: /etc/nginx/sites-enabled/ara.conf
|
|
state: link
|
|
when: ansible_os_family == 'Debian'
|
|
notify:
|
|
- restart nginx
|