library/roles/ELK/elasticHQ: playbook that installs elasticHQ. It's a standalone app now.

This commit is contained in:
Andrea Dell'Amico 2018-02-17 11:18:30 +01:00
parent de8bd78c8d
commit 3a93132a84
4 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,12 @@
---
elastic_hq_repo_url: https://github.com/ElasticHQ/elasticsearch-HQ.git
elastic_hq_user: elastichq
elastic_hq_home: /srv/elastichq
elastic_hq_http_port: 5000
elastic_hq_use_nginx_proxy: True
elastic_hq_python_pkgs:
- python3
- python3-pip
elastic_hq_start_cmd: './manage.py runserver'

View File

@ -0,0 +1,3 @@
---
dependencies:
- { role: '../../library/roles/nginx', when: elastic_hq_use_nginx_proxy }

View File

@ -0,0 +1,23 @@
---
- block:
- name: Install git
apt: pkg=git update_cache=yes cache_valid_time=1800
- name: Install the minimal python 3 env
apt: pkg={{ item }} update_cache=yes cache_valid_time=1800
with_items: '{{ elastic_hq_python_pkgs }}'
- name: Create a user to run the elasticHQ service
user: name={{ elastic_hq_user }} home={{ elastic_hq_home }} createhome=no shell=/usr/sbin/nologin system=yes
- name: Create the user home directory
file: dest={{ elastic_hq_home }} state=directory owner={{ elastic_hq_user }} group={{ elastic_hq_user }}
- name: Get the elasticHQ distribution
git: repo={{ elastic_hq_repo_url }} dest={{ elastic_hq_home }}
# - name: Get the elasticHQ dependencies
# pip: chdir={{ elastic_hq_home }} executable=pip3 requirements=requirements.tx
tags: [ 'elasticsearch', 'elastic_hq' ]

View File

@ -0,0 +1,17 @@
[Unit]
Description=ElasticHQ - Monitoring and Management Web Application for ElasticSearch instances and clusters.
After=network.target
[Service]
Type=simple
WorkingDirectory={{ elastic_hq_home }}
StandardOutput=syslog
StandardError=syslog
Restart=on-failure
RemainAfterExit=yes
User={{ elastic_hq_user }}
Group={{ elastic_hq_user }}
ExecStart={{ elastic_hq_start_cmd }}