ansible-role-elasticsearch/tasks/elasticsearch-Debian.yml
Julien Mailleret 2cb020a4c2
Remove multi instances support (#566)
* remove multi instances support
The goal is to stop supporting installation of more than one node in the same host. This commit update the Ansible role README documentation and remove the multi instances kitchen test.

* remove systemd and init.d templates
As we no more need to support more than one node on the same host, we no more need to override init files provided by elasticsearch official packages.

* remove file script feature
File scripts have been removed since elasticsearch 6.0 (https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_scripting_changes.html#_file_scripts_removed)

* remove custom user and custom group
ES_USER and ES_GROUP settings are no longer supported (https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_packaging_changes.html#_configuring_custom_user_and_group_for_package_is_no_longer_allowed)

* add upgrade procedure

* use same task for license activation with and without authentication
2019-06-03 14:18:09 +02:00

87 lines
2.7 KiB
YAML

---
- name: set fact force_install to no
set_fact: force_install=no
- name: set fact force_install to yes
set_fact: force_install=yes
when: es_allow_downgrades
- name: Gracefully stop and remove elasticsearch package if switching between OSS and standard
become: yes
block:
- name: Check if the elasticsearch package is installed
shell: "dpkg-query -W -f'${Status}' {{ es_other_package_name }}"
register: elasticsearch_package
failed_when: False
changed_when: False
check_mode: no
- name: stop elasticsearch
service:
name: 'elasticsearch'
state: stopped
when: elasticsearch_package.stdout == 'install ok installed'
- name: Debian - Remove elasticsearch package if we are switching to a different package type
apt:
name: '{{ es_other_package_name }}'
state: absent
when: elasticsearch_package.stdout == 'install ok installed'
- name: Install Elasticsearch repository
when: es_use_repository
become: yes
block:
- name: Debian - Install apt-transport-https to support https APT downloads
apt:
name: apt-transport-https
state: present
- name: Debian - Add Elasticsearch repository key
apt_key:
url: '{{ es_apt_key }}'
state: present
when: es_apt_key | string
- name: Debian - Add elasticsearch repository
apt_repository:
repo: '{{ item.repo }}'
state: '{{ item.state }}'
with_items:
- { repo: "{{ es_apt_url_old }}", state: "absent" }
- { repo: "{{ es_apt_url }}", state: "present" }
- { repo: "{{ es_other_apt_url }}", state: "absent" }
- name: Debian - Ensure elasticsearch is installed
become: yes
apt:
name: '{{ es_package_name }}{% if es_version is defined and es_version != "" %}={{ es_version }}{% endif %}'
state: present
force: '{{ force_install }}'
allow_unauthenticated: "{{ 'no' if es_apt_key else 'yes' }}"
cache_valid_time: 86400
when: es_use_repository
register: debian_elasticsearch_install_from_repo
notify: restart elasticsearch
environment:
ES_PATH_CONF: "/etc/elasticsearch"
- name: Debian - Include versionlock
include: elasticsearch-Debian-version-lock.yml
when: es_version_lock
- name: Debian - Download elasticsearch from url
get_url: url={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.deb{% endif %} dest=/tmp/elasticsearch-{{ es_version }}.deb validate_certs=no
when: not es_use_repository
- name: Debian - Ensure elasticsearch is installed from downloaded package
become: yes
apt: deb=/tmp/elasticsearch-{{ es_version }}.deb
when: not es_use_repository
register: elasticsearch_install_from_package
notify: restart elasticsearch
environment:
ES_PATH_CONF: "/etc/elasticsearch"