123 lines
3.7 KiB
YAML
123 lines
3.7 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/>.
|
|
|
|
- name: Include OS family/distribution specific variables
|
|
include_vars: "{{ item }}"
|
|
with_first_found:
|
|
- "{{ ansible_distribution }}.yml"
|
|
- "{{ ansible_os_family }}.yml"
|
|
|
|
- name: Override default variables
|
|
set_fact:
|
|
ara: "{{ ara | combine(ara_override, recursive=true) }}"
|
|
when:
|
|
- ara_override is defined
|
|
- ara_override is mapping
|
|
|
|
- name: Include ARA installation
|
|
include_tasks: "install/{{ ara.params.install.method }}.yml"
|
|
|
|
- name: Create user for ARA
|
|
become: true
|
|
user:
|
|
name: ara
|
|
comment: User for ARA Records Ansible
|
|
shell: /sbin/nologin
|
|
home: /var/lib/ara
|
|
|
|
- name: Create ARA directories
|
|
become: true
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: ara
|
|
group: ara
|
|
mode: 0750
|
|
with_items:
|
|
- /var/log/ara
|
|
- /var/lib/ara
|
|
- /etc/ara
|
|
|
|
- name: Setup ARA logrotate
|
|
become: true
|
|
template:
|
|
src: logrotate.conf.j2
|
|
dest: /etc/logrotate.d/ara
|
|
|
|
- name: Include web server configuration
|
|
include_tasks: "{{ ara.deployment.server }}/{{ ara.deployment.type }}.yml"
|
|
|
|
- name: Create the ARA configuration file
|
|
become: true
|
|
ini_file:
|
|
path: /etc/ara/ara.cfg
|
|
section: ara
|
|
option: "{{ item.key }}"
|
|
value: "{{ item.value }}"
|
|
create: yes
|
|
owner: ara
|
|
group: ara
|
|
mode: 0640
|
|
with_dict: "{{ ara.config }}"
|
|
notify:
|
|
- restart ara
|
|
- restart nginx
|
|
|
|
- name: Get ARA's installed location
|
|
command: python -m ara.setup.path
|
|
environment:
|
|
PATH: "{{ path_with_virtualenv | default(omit) }}"
|
|
register: ara_location
|
|
changed_when: false
|
|
|
|
- name: Enable ARA Ansible configuration
|
|
become: true
|
|
ini_file:
|
|
dest: /etc/ara/ara.cfg
|
|
section: defaults
|
|
option: "{{ item.option }}"
|
|
value: "{{ item.value }}"
|
|
with_items:
|
|
- { option: local_tmp, value: /var/lib/ara/.ansible/ }
|
|
- { option: callback_plugins, value: "{{ ara_location.stdout }}/plugins/callbacks" }
|
|
- { option: action_plugins, value: "{{ ara_location.stdout }}/plugins/actions" }
|
|
|
|
- name: Provide web application URL
|
|
vars:
|
|
msg: >-
|
|
ARA was installed successfully !
|
|
The web application should now be reachable at http://{{ ara.config.host_proxy | default(ara.config.host) }}:{{ ara.config.port_proxy | default(ara.config.port) }} !
|
|
debug:
|
|
msg: "{{ msg.split('\n') }}"
|
|
|
|
- name: Provide instructions
|
|
vars:
|
|
msg: >-
|
|
To customize the host and port on which the web application is served, supply an 'ara_override' dictionary variables with new host and port keys.
|
|
|
|
A configuration file was set up automatically in /etc/ara/ara.cfg.
|
|
The ARA service is already using this configuration file but you'll need to make sure Ansible is using it so that Ansible knows where ARA is located.
|
|
|
|
This can be done by exporting the ANSIBLE_CONFIG environment variable, like so:
|
|
$ export ANSIBLE_CONFIG=/etc/ara/ara.cfg
|
|
$ ansible-playbook playbook.yml
|
|
|
|
Data from recorded playbooks will be available in the interface as soon as you run your first ansible-playbook command.
|
|
debug:
|
|
msg: "{{ msg.split('\n') }}"
|