head plugin creates a dedicated user

This commit is contained in:
Jérémy Lecour 2016-11-21 17:30:25 +01:00 committed by Jérémy Lecour
parent cfd1e690fb
commit ae47a8e030
2 changed files with 26 additions and 24 deletions

View file

@ -1,3 +1,4 @@
elasticsearch_plugin_head_install_path: /var/www2/elasticsearch-head
elasticsearch_plugin_head_owner: "www-data"
elasticsearch_plugin_head_group: "www-data"
elasticsearch_plugin_head_home: /home/elasticsearch-head
elasticsearch_plugin_head_clone_dir: "{{ elasticsearch_plugin_head_home }}/www"
elasticsearch_plugin_head_owner: "elasticsearch-head"
elasticsearch_plugin_head_group: "elasticsearch-head"

View file

@ -36,29 +36,30 @@
- packages
- npm
- name: Head repository is check-out
git:
repo: "git://github.com/mobz/elasticsearch-head.git"
dest: "{{ elasticsearch_plugin_head_install_path }}"
clone: yes
tags:
- elasticsearch
- name: "User {{ elasticsearch_plugin_head_owner }} is present"
user:
name: "{{ elasticsearch_plugin_head_owner }}"
home: "{{ elasticsearch_plugin_head_home }}"
createhome: yes
system: yes
shell: /bin/false
- name: NPM packages for head are installed
npm:
path: "{{ elasticsearch_plugin_head_install_path }}"
tags:
- packages
- npm
- block:
- name: Head repository is check-out
git:
repo: "git://github.com/mobz/elasticsearch-head.git"
dest: "{{ elasticsearch_plugin_head_clone_dir }}"
clone: yes
tags:
- packages
- name: "Directory is owned by {{ elasticsearch_plugin_head_owner }}"
file:
path: "{{ elasticsearch_plugin_head_install_path }}"
owner: "{{ elasticsearch_plugin_head_owner }}"
group: "{{ elasticsearch_plugin_head_group }}"
state: directory
tags:
- elasticsearch
- name: NPM packages for head are installed
npm:
path: "{{ elasticsearch_plugin_head_clone_dir }}"
tags:
- packages
- npm
become_user: "{{ elasticsearch_plugin_head_owner }}"
- name: Elasticsearch HTTP/CORS are enabled
lineinfile: