ansible-development-environ.../roles/ara/tasks/main.yml

72 lines
1.7 KiB
YAML

---
# tasks file for ara
- name: include assert.yml
import_tasks: assert.yml
run_once: yes
delegate_to: localhost
- name: install ara
ansible.builtin.pip:
name: ara[server]
state: present
- name: create ara service
ansible.builtin.import_role:
name: robertdebock.service
vars:
service_list:
- name: ara
description: Ansible Reports Ara
start_command: "{{ ara_binary_location }}/ara-manage runserver"
user_name: "{{ ara_user }}"
- name: find callback_plugins path
block:
- name: try python2
ansible.builtin.command: "{{ ara_setup_command_python2 }}"
register: ara_callback_plugins
changed_when: no
check_mode: no
rescue:
- name: try python3
ansible.builtin.command: "{{ ara_setup_command_python3 }}"
register: ara_callback_plugins
changed_when: no
- name: configure ansible and ara
block:
- name: configure ansible to use ara
community.general.ini_file:
path: "{{ ara_configuration_file }}"
section: defaults
option: callback_plugins
value: "{{ ara_callback_plugins.stdout }}"
mode: "0644"
notify:
- restart ara
when:
- ara_callback_plugins.stdout is defined
- name: configure ara
community.general.ini_file:
path: "{{ ara_configuration_file }}"
section: ara
option: "{{ item.option }}"
value: "{{ item.value }}"
mode: "0644"
notify:
- restart ara
loop: "{{ ara_configuration }}"
loop_control:
label: "{{ item.option }}"
when:
- ara_configuration is defined
- name: start and enable ara
ansible.builtin.service:
name: ara
state: started
enabled: yes