openstack-ansible-ops/elk_metrics_7x/roles/elasticsearch/tasks/elasticsearch_plugins.yml
Erik Berg c7e76e119f Get elastic plugins via proxy
Some environments don't have routed internet and can only get data
via proxies. If proxy_env_url is set, try getting files via that.

Change-Id: I97b728484894e75ebc8c4e55b98b2e3eea42baf6
2021-03-01 08:13:51 +00:00

35 lines
1.5 KiB
YAML

---
# Copyright 2018, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Remove plugins
command: "/usr/share/elasticsearch/bin/elasticsearch-plugin remove --verbose {{ item.name }}"
failed_when: false
changed_when:
- remove_plugin.rc == 0
register: remove_plugin
with_items: "{{ elastic_plugins }}"
- name: Install plugins
command: "/usr/share/elasticsearch/bin/elasticsearch-plugin install --batch --verbose {{ item.remote | default(item.name) }}"
with_items: "{{ elastic_plugins }}"
when: proxy_env_url is not defined
- name: Install plugins via proxy
command: "/usr/share/elasticsearch/bin/elasticsearch-plugin install --batch --verbose {{ item.remote | default(item.name) }}"
environment:
ES_JAVA_OPTS: "-Dhttp.proxyHost={{ proxy_env_url | urlsplit('hostname') }} -Dhttp.proxyPort={{ proxy_env_url | urlsplit('port') }} -Dhttps.proxyHost={{ proxy_env_url | urlsplit('hostname') }} -Dhttps.proxyPort={{ proxy_env_url | urlsplit('port') }}"
with_items: "{{ elastic_plugins }}"
when: proxy_env_url is defined