Changed debian repo from http to https, but exisiting http repos (from earlier runs) would persist and lead to an duplicate entry warning in apt. This PR will remove the old http repo, if present.
43 lines
1.6 KiB
YAML
43 lines
1.6 KiB
YAML
---
|
|
|
|
- set_fact: force_install=no
|
|
|
|
- set_fact: force_install=yes
|
|
when: es_allow_downgrades
|
|
|
|
- name: Debian - Install apt-transport-https to support https APT downloads
|
|
apt: name=apt-transport-https state=present
|
|
when: es_use_repository
|
|
|
|
- name: Debian - Add Elasticsearch repository key
|
|
apt_key: url="{{ es_apt_key }}" state=present
|
|
when: es_use_repository and es_apt_key
|
|
|
|
- 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" }
|
|
when: es_use_repository
|
|
|
|
- name: Debian - Include versionlock
|
|
include: elasticsearch-Debian-version-lock.yml
|
|
when: es_version_lock
|
|
|
|
- name: Debian - Ensure elasticsearch is installed
|
|
apt: name=elasticsearch{% if es_version is defined and es_version != "" %}={{ es_version }}{% endif %} state=present force={{force_install}} cache_valid_time=86400
|
|
when: es_use_repository
|
|
register: elasticsearch_install_from_repo
|
|
|
|
- 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
|
|
apt: deb=/tmp/elasticsearch-{{ es_version }}.deb
|
|
when: not es_use_repository
|
|
register: elasticsearch_install_from_package
|
|
|
|
# ansible uri module requires httplib2
|
|
- name: python-httplib2
|
|
apt: name=python-httplib2
|