mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
---
|
|
- name: Check Elastic Search installation
|
|
shell: apt-cache policy elasticsearch | grep -Po 'Installed:\s(.*)' | cut -d' ' -f 2;
|
|
changed_when: false
|
|
register: install_status
|
|
|
|
- name: Set installed variable
|
|
set_fact: is_installed='{{ install_status.stdout == elasticsearch.version }}'
|
|
|
|
- name: Add dependencies repository
|
|
apt_repository: repo='ppa:webupd8team/java' update_cache=yes
|
|
|
|
- name: Set dependencies License
|
|
shell: echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
|
|
changed_when: false
|
|
|
|
- name: Install Dependencies
|
|
apt: pkg=oracle-java8-installer state=latest
|
|
|
|
- name: Download
|
|
get_url: >
|
|
url={{ elasticsearch_url }}
|
|
dest=/tmp/elasticsearch-{{ elasticsearch.version }}.deb
|
|
when: not is_installed
|
|
|
|
- name: Install
|
|
apt: deb=/tmp/elasticsearch-{{ elasticsearch.version }}.deb
|
|
when: not is_installed
|
|
|
|
- name: Install plugins
|
|
shell: /usr/share/elasticsearch/bin/plugin install {{ item.name }}/{{ item.version }}
|
|
when: not is_installed
|
|
with_items: "{{ elasticsearch.plugins }}"
|
|
|
|
- name: Set port
|
|
replace: >
|
|
dest="/etc/elasticsearch/elasticsearch.yml"
|
|
regexp='^#?(http\.port\:).*'
|
|
replace='\1 {{ elasticsearch.port }}'
|
|
|
|
- name: Flush handlers to apply config changes
|
|
meta: flush_handlers
|
|
|
|
- name: Enable Service
|
|
service: name=elasticsearch enabled=yes
|
|
|
|
- name: Ensure Elastic Search is started
|
|
service: name=elasticsearch state=started
|
|
|
|
- name: Remove tmp files
|
|
file: path=/tmp/elasticsearch-{{ elasticsearch.version }}.deb state=absent
|
|
when: not is_installed
|