ansible-role-elasticsearch/tasks/elasticsearch-RedHat.yml

69 lines
2.3 KiB
YAML
Raw Normal View History

2015-05-13 09:45:55 +02:00
---
- 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
2017-05-12 13:31:50 -07:00
become: yes
yum: name=libselinux-python state=present update_cache=yes
when: ( ansible_distribution == "CentOS" ) and ( ansible_distribution_major_version == "6" )
2015-05-13 09:45:55 +02:00
- name: RedHat - add Elasticsearch repo
2017-05-12 13:31:50 -07:00
become: yes
template:
src: 'elasticsearch.repo'
dest: '/etc/yum.repos.d/elasticsearch-{{ es_repo_name }}.repo'
when: es_use_repository and es_add_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
2015-09-07 11:18:42 +02:00
- name: RedHat - include versionlock
include: elasticsearch-RedHat-version-lock.yml
- name: RedHat - Remove the other elasticsearch package if switching between OSS and standard
become: yes
yum:
name: '{{ es_other_package_name }}'
state: 'absent'
- name: Include optional user and group creation.
when: (es_user_id is defined) and (es_group_id is defined)
include: elasticsearch-optional-user.yml
- name: RedHat - Install Elasticsearch
2017-05-12 13:31:50 -07:00
become: yes
2018-06-13 08:29:45 +02:00
yum:
name: '{{ es_package_name }}{% if es_version is defined and es_version != "" %}-{{ es_version }}{% endif %}'
2018-06-13 08:29:45 +02:00
state: present
update_cache: yes
allow_downgrade: '{{ allow_downgrade }}'
when: es_use_repository and not ansible_check_mode
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: "{{ es_conf_dir }}"
# workaround due to https://github.com/ansible/ansible/issues/66977
- set_fact:
es_rpm_url: "{% if es_version is version('7.0.0', '>=') %}{{ es_package_url }}-{{ es_version }}-x86_64.rpm{% else %}{{ es_package_url }}-{{ es_version }}.rpm{% endif %}"
- name: RedHat - Install Elasticsearch from url
2017-05-12 13:31:50 -07:00
become: yes
yum:
name: '{% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_rpm_url }}{% endif %}'
state: present
when: not es_use_repository
register: elasticsearch_install_from_package
notify: restart elasticsearch