ansible-role-ara/tasks/main.yml

80 lines
2.5 KiB
YAML

---
# Copyright 2017 Red Hat, Inc. All Rights Reserved.
#
# 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: Include OS family/distribution specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- name: Install required dependencies
package:
name: "{{ item }}"
state: "present"
with_items: "{{ required_packages }}"
become: true
- name: Install pip
easy_install:
name: pip
state: present
become: true
- name: Install ARA with pip
pip:
name: ara
state: present
become: true
- include_tasks: apache_server.yml
when: use_apache_server
- include_tasks: embedded_server.yaml
when: not use_apache_server
- name: Get ARA installed location
shell: python -c "import os,ara; print(os.path.dirname(ara.__file__))"
register: ara_location
changed_when: false
- name: Enable ARA callback plugin
ini_file:
dest: "{{ ara_config_path }}/ansible.cfg"
section: defaults
option: callback_plugins
value: "{{ ara_location.stdout }}/plugins/callbacks"
become: true
- name: Provide web application URL
vars:
msg: >-
ARA was installed succesfully !
The web application should now be reachable at http://{{ ara_host }}:{{ ara_port }} !
To customize the host and port on which the application listens to, override the defaults for the ara_host and ara_port variables.
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') }}"
- name: Provide instructions
vars:
msg: >-
We've set up an ansible.cfg file for you inside {{ ara_config_path }}.
Make sure to have Ansible and ARA use it for everything to work properly.
This can be done from using Ansible or the ARA CLI commands directly from that directory or by using the ANSIBLE_CONFIG environment variable, like so:
export ANSIBLE_CONFIG={{ ara_config_path }}/ansible.cfg
debug:
msg: "{{ msg.split('\n') }}"