Define a proxy for plugin installation
Address the issue [ansible-elasticsearch #4](https://github.com/elastic/ansible-elasticsearch/issues/4) which add proxy for plugin installation and more generally es_proxy_host and es_proxy_port for global usage. Right now, it’s only used for plugins installation. In the futur, it can be used (or defined) in the java_opts within the default file for instance (elasticsearch.j2)
This commit is contained in:
parent
0fd268ca3f
commit
3f213a3b64
3 changed files with 34 additions and 3 deletions
24
README.md
24
README.md
|
|
@ -100,6 +100,8 @@ A more complex example:
|
||||||
- plugin: marvel-agent
|
- plugin: marvel-agent
|
||||||
- plugin: lmenezes/elasticsearch-kopf
|
- plugin: lmenezes/elasticsearch-kopf
|
||||||
version: master
|
version: master
|
||||||
|
proxy_host: proxy.example.com
|
||||||
|
proxy_port: 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
### Multi Node Server Installations
|
### Multi Node Server Installations
|
||||||
|
|
@ -166,8 +168,7 @@ Following variables affect the versions installed:
|
||||||
- plugin: elasticsearch-cloud-aws
|
- plugin: elasticsearch-cloud-aws
|
||||||
version: 2.5.0
|
version: 2.5.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Earlier examples illustrate the installation of plugins for 2.x. The correct use of this parameter varies depending on the version of Elasticsearch being installed:
|
Earlier examples illustrate the installation of plugins for 2.x. The correct use of this parameter varies depending on the version of Elasticsearch being installed:
|
||||||
|
|
||||||
- 2.x. - For officially supported plugins no version or source delimiter is required. The plugin script will determine the appropriate plugin version based on the target Elasticsearch version.
|
- 2.x. - For officially supported plugins no version or source delimiter is required. The plugin script will determine the appropriate plugin version based on the target Elasticsearch version.
|
||||||
|
|
@ -188,6 +189,25 @@ controlled by the following parameters:
|
||||||
* ```es_work_dir``` - defaults to "/tmp/elasticsearch".
|
* ```es_work_dir``` - defaults to "/tmp/elasticsearch".
|
||||||
* ```es_plugin_dir``` - defaults to "/usr/share/elasticsearch/plugins".
|
* ```es_plugin_dir``` - defaults to "/usr/share/elasticsearch/plugins".
|
||||||
|
|
||||||
|
### Proxy
|
||||||
|
|
||||||
|
To define proxy globaly, set the following variables:
|
||||||
|
|
||||||
|
* ```es_proxy_host``` - global proxy host
|
||||||
|
* ```es_proxy_port``` - global proxy port
|
||||||
|
|
||||||
|
To define proxy only for a particular plugin during its installation:
|
||||||
|
|
||||||
|
```
|
||||||
|
es_plugins:
|
||||||
|
- plugin: elasticsearch-cloud-aws
|
||||||
|
version: 2.5.0
|
||||||
|
proxy_host: proxy.example.com
|
||||||
|
proxy_port: 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
> For plugins installation, proxy_host and proxy_port are used first if they are defined and fallback to the global proxy settings if not.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
* The role assumes the user/group exists on the server. The elasticsearch packages create the default elasticsearch user. If this needs to be changed, ensure the user exists.
|
* The role assumes the user/group exists on the server. The elasticsearch packages create the default elasticsearch user. If this needs to be changed, ensure the user exists.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
- fail: msg="es_instance_name must be specified and cannot be blank"
|
- fail: msg="es_instance_name must be specified and cannot be blank"
|
||||||
when: es_instance_name is not defined or es_instance_name == ''
|
when: es_instance_name is not defined or es_instance_name == ''
|
||||||
|
|
||||||
|
- fail: msg="es_proxy_port must be specified and cannot be blank when es_proxy_host is defined"
|
||||||
|
when: (es_proxy_port is not defined or es_proxy_port == '') and (es_proxy_host is defined and es_proxy_host != '')
|
||||||
|
|
||||||
- set_fact: multi_cast={{ (es_version | version_compare('2.0', '<') and es_config['discovery.zen.ping.multicast.enabled'] is not defined) or (es_config['discovery.zen.ping.multicast.enabled'] is defined and es_config['discovery.zen.ping.multicast.enabled'])}}
|
- set_fact: multi_cast={{ (es_version | version_compare('2.0', '<') and es_config['discovery.zen.ping.multicast.enabled'] is not defined) or (es_config['discovery.zen.ping.multicast.enabled'] is defined and es_config['discovery.zen.ping.multicast.enabled'])}}
|
||||||
|
|
||||||
- debug: msg="WARNING - It is recommended you specify the parameter 'http.port' when multicast is disabled"
|
- debug: msg="WARNING - It is recommended you specify the parameter 'http.port' when multicast is disabled"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,15 @@
|
||||||
|
|
||||||
- name: Install elasticsearch plugins
|
- name: Install elasticsearch plugins
|
||||||
#debug: var=item
|
#debug: var=item
|
||||||
command: "{{es_home}}/bin/plugin install {{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %} --silent"
|
command: >
|
||||||
|
{{es_home}}/bin/plugin install
|
||||||
|
{{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %}
|
||||||
|
{% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%}
|
||||||
|
-DproxyHost={{ item.proxy_host }} -DproxyPort={{ item.proxy_port }}
|
||||||
|
{% elif es_proxy_host is defined and es_proxy_host != '' %}
|
||||||
|
-DproxyHost={{ es_proxy_host }} -DproxyPort={{ es_proxy_port }}
|
||||||
|
{% endif %}
|
||||||
|
--silent
|
||||||
register: plugin_installed
|
register: plugin_installed
|
||||||
failed_when: "'Failed to install' in plugin_installed.stderr"
|
failed_when: "'Failed to install' in plugin_installed.stderr"
|
||||||
changed_when: plugin_installed.rc == 0
|
changed_when: plugin_installed.rc == 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue