59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
---
|
|
- name: set fact allow_downgrade to no
|
|
set_fact: allow_downgrade=no
|
|
|
|
- name: set fact allow_downgrade to yes
|
|
set_fact: allow_downgrade=yes
|
|
when: es_allow_downgrades
|
|
|
|
- name: Ensure libselinux-python on CentOS 6.x
|
|
become: yes
|
|
yum: name=libselinux-python state=present update_cache=yes
|
|
when: ( ansible_distribution == "CentOS" ) and ( ansible_distribution_major_version == "6" )
|
|
|
|
- name: RedHat - add Elasticsearch repo
|
|
become: yes
|
|
template:
|
|
src: 'elasticsearch.repo'
|
|
dest: '/etc/yum.repos.d/elasticsearch-{{ es_repo_name }}.repo'
|
|
when: es_use_repository
|
|
|
|
- name: RedHat - remove unused Elasticsearch repo
|
|
become: yes
|
|
file:
|
|
path: '/etc/yum.repos.d/elasticsearch-{{ es_other_repo_name }}.repo'
|
|
state: absent
|
|
when: es_use_repository
|
|
|
|
- name: RedHat - include versionlock
|
|
include: elasticsearch-RedHat-version-lock.yml
|
|
when: es_version_lock
|
|
|
|
- name: RedHat - Remove the other elasticsearch package if switching between OSS and standard
|
|
become: yes
|
|
yum:
|
|
name: '{{ es_other_package_name }}'
|
|
state: 'absent'
|
|
|
|
- name: RedHat - Install Elasticsearch
|
|
become: yes
|
|
yum:
|
|
name: '{{ es_package_name }}{% if es_version is defined and es_version != "" %}-{{ es_version }}{% endif %}'
|
|
state: present
|
|
update_cache: yes
|
|
allow_downgrade: '{{ allow_downgrade }}'
|
|
when: es_use_repository
|
|
register: redhat_elasticsearch_install_from_repo
|
|
notify: restart elasticsearch
|
|
until: redhat_elasticsearch_install_from_repo.rc == 0
|
|
retries: 5
|
|
delay: 10
|
|
environment:
|
|
ES_PATH_CONF: "/etc/elasticsearch"
|
|
|
|
- name: RedHat - Install Elasticsearch from url
|
|
become: yes
|
|
yum: name={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.noarch.rpm{% endif %} state=present
|
|
when: not es_use_repository
|
|
register: elasticsearch_install_from_package
|
|
notify: restart elasticsearch
|