diff --git a/ELK/elasticHQ/defaults/main.yml b/ELK/elasticHQ/defaults/main.yml new file mode 100644 index 00000000..ff3a9506 --- /dev/null +++ b/ELK/elasticHQ/defaults/main.yml @@ -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' diff --git a/ELK/elasticHQ/meta/main.yml b/ELK/elasticHQ/meta/main.yml new file mode 100644 index 00000000..20e13dd6 --- /dev/null +++ b/ELK/elasticHQ/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - { role: '../../library/roles/nginx', when: elastic_hq_use_nginx_proxy } diff --git a/ELK/elasticHQ/tasks/main.yml b/ELK/elasticHQ/tasks/main.yml new file mode 100644 index 00000000..4a4068b6 --- /dev/null +++ b/ELK/elasticHQ/tasks/main.yml @@ -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' ] + diff --git a/ELK/elasticHQ/templates/elastichq.systemd.j2 b/ELK/elasticHQ/templates/elastichq.systemd.j2 new file mode 100644 index 00000000..8dc4cfc9 --- /dev/null +++ b/ELK/elasticHQ/templates/elastichq.systemd.j2 @@ -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 }} +