Merge pull request #221 from gingerwizard/master

Use api_host and api_port + removal of tests
This commit is contained in:
Dale McDiarmid 2017-01-03 16:06:52 +00:00 committed by GitHub
commit 0105003c72
4 changed files with 21 additions and 73 deletions

View file

@ -22,14 +22,6 @@ platforms:
- apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:ansible/ansible - apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:ansible/ansible
- apt-get update && apt-get -y -q install python-apt python-pycurl - apt-get update && apt-get -y -q install python-apt python-pycurl
use_sudo: false use_sudo: false
- name: debian-7
driver_config:
image: dliappis/debian-devopsci:7
privileged: true
provision_command:
- apt-get update && apt-get -y install python python-dev python-pip build-essential libyaml-dev python-yaml
- apt-get install -y -q net-tools
use_sudo: false
- name: debian-8 - name: debian-8
driver_config: driver_config:
image: dliappis/debian-devopsci:8 image: dliappis/debian-devopsci:8
@ -43,12 +35,6 @@ platforms:
- sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config - sed -ri 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config
use_sudo: false use_sudo: false
run_command: "/sbin/init" run_command: "/sbin/init"
- name: centos-6
driver_config:
image: dliappis/centos-devopsci:6
privileged: true
provision_command:
use_sudo: false
- name: centos-7 - name: centos-7
driver_config: driver_config:
image: dliappis/centos-devopsci:7 image: dliappis/centos-devopsci:7
@ -92,48 +78,6 @@ suites:
version: master version: master
provisioner: provisioner:
playbook: test/integration/multi.yml playbook: test/integration/multi.yml
- name: standard-1x
provisioner:
playbook: test/integration/standard.yml
run_list:
attributes:
extra_vars:
es_major_version: 1.7
es_version: 1.7.3
- name: package-1x
run_list:
attributes:
extra_vars:
es_major_version: 1.7
es_version: 1.7.3
es_plugins:
- plugin: lmenezes/elasticsearch-kopf
version: master
- plugin: elasticsearch/marvel
version: latest
provisioner:
playbook: test/integration/package.yml
- name: config-1x
run_list:
attributes:
extra_vars:
es_major_version: 1.7
es_version: 1.7.3
provisioner:
playbook: test/integration/config.yml
- name: multi-1x
run_list:
attributes:
extra_vars:
es_major_version: 1.7
es_version: 1.7.3
es_plugins:
- plugin: lmenezes/elasticsearch-kopf
version: master
- plugin: elasticsearch/marvel
version: latest
provisioner:
playbook: test/integration/multi.yml
- name: xpack-2x - name: xpack-2x
run_list: run_list:
attributes: attributes:

View file

@ -3,12 +3,10 @@
Ansible role for Elasticsearch. Currently this works on Debian and RedHat based linux systems. Tested platforms are: Ansible role for Elasticsearch. Currently this works on Debian and RedHat based linux systems. Tested platforms are:
* Ubuntu 14.04 * Ubuntu 14.04
* Debian 7
* Debian 8 * Debian 8
* Centos 6
* Centos 7 * Centos 7
The latest Elasticsearch versions of 1.7.x and 2.x are actively tested. **Only Ansible versions > 2.1.2 are supported.** The latest Elasticsearch versions of 2.x are actively tested. **Only Ansible versions > 2.1.2 are supported.**. 5.x will be available shortly.
## Usage ## Usage
@ -75,7 +73,7 @@ The following illustrates applying configuration parameters to an Elasticsearch
es_heap_size: 1g es_heap_size: 1g
``` ```
` `
The role utilises Elasticsearch version defaults. Multicast is therefore enabled for 1.x and disabled for 2.x (plugin required in 2.x). If using 1.x it is strongly recommended you disable The role utilises Elasticsearch version defaults. Multicast is therefore enabled for 1.x (legacy) and disabled for 2.x (plugin required in 2.x). If using 1.x it is strongly recommended you disable
multicast and specify the required uni-cast settings for a production environment. multicast and specify the required uni-cast settings for a production environment.
When not utilizing multicast, the following should be set to ensure a successful cluster forms. When not utilizing multicast, the following should be set to ensure a successful cluster forms.
@ -128,6 +126,11 @@ A more complex example:
proxy_port: 8080 proxy_port: 8080
``` ```
#### Important Note
The role uses es_api_host and es_api_port to communicate with the node for actions only achievable via http e.g. to install templates. These default to "localhost" and 9200 respectively.
If the node is deployed to bind on either a different host or port, these must be changed.
### Multi Node Server Installations ### Multi Node Server Installations
The application of the elasticsearch role results in the installation of a node on a host. Specifying the role multiple times for a host therefore results in the installation of multiple nodes for the host. The application of the elasticsearch role results in the installation of a node on a host. Specifying the role multiple times for a host therefore results in the installation of multiple nodes for the host.
@ -212,8 +215,10 @@ Additional parameters to es_config allow the customization of the Java and Elast
Following variables affect the versions installed: Following variables affect the versions installed:
* ```es_major_version``` (e.g. "1.5" ). Should be consistent with es_version. For versions >= 2.0 this must be "2.x". * ```es_major_version``` (e.g. "2.4" ). Should be consistent with es_version. For versions >= 2.0 this must be "2.x".
* ```es_version``` (e.g. "1.5.2"). * ```es_version``` (e.g. "2.4.2").
* ```es_api_host``` The host name used for actions requiring HTTP e.g. installing templates. Defaults to "localhost".
* ```es_api_port``` The port used for actions requiring HTTP e.g. installing templates. Defaults to 9200.
* ```es_start_service``` (true (default) or false) * ```es_start_service``` (true (default) or false)
* ```es_plugins_reinstall``` (true or false (default) ) * ```es_plugins_reinstall``` (true or false (default) )
* ```es_plugins``` an array of plugin definitions e.g.: * ```es_plugins``` an array of plugin definitions e.g.:
@ -235,7 +240,6 @@ Earlier examples illustrate the installation of plugins for 2.x. The correct us
- 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.
For community based plugins include the full path e.g. "lmenezes/elasticsearch-kopf" and the appropriate version for the target version of Elasticsearch. For community based plugins include the full path e.g. "lmenezes/elasticsearch-kopf" and the appropriate version for the target version of Elasticsearch.
- 1.x - Full path and version is required for both community and official plugins e.g. "elasticsearch/marvel"
If installing Marvel or Watcher, ensure the license plugin is also specified. Shield configuration is currently not supported but planned for later versions. If installing Marvel or Watcher, ensure the license plugin is also specified. Shield configuration is currently not supported but planned for later versions.

View file

@ -4,7 +4,7 @@
service: name={{instance_init_script | basename}} state=started enabled=yes service: name={{instance_init_script | basename}} state=started enabled=yes
- name: Wait for elasticsearch to startup - name: Wait for elasticsearch to startup
wait_for: host={% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %} port={% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %} delay=10 wait_for: host={{es_api_host}} port={{es_api_port}} delay=10
- name: Get template files - name: Get template files
find: paths="/etc/elasticsearch/templates" patterns="*.json" find: paths="/etc/elasticsearch/templates" patterns="*.json"
@ -12,7 +12,7 @@
- name: Install templates without auth - name: Install templates without auth
uri: uri:
url: "http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_template/{{item.path | filename}}" url: "http://{{es_api_host}}:{{es_api_port}}/_template/{{item.path | filename}}"
method: PUT method: PUT
status_code: 200 status_code: 200
body_format: json body_format: json
@ -22,7 +22,7 @@
- name: Install templates with auth - name: Install templates with auth
uri: uri:
url: "http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_template/{{item.path | filename}}" url: "http://{{es_api_host}}:{{es_api_port}}/_template/{{item.path | filename}}"
method: PUT method: PUT
status_code: 200 status_code: 200
user: "{{es_api_basic_auth_username}}" user: "{{es_api_basic_auth_username}}"

View file

@ -4,7 +4,7 @@
service: name={{instance_init_script | basename}} state=started enabled=yes service: name={{instance_init_script | basename}} state=started enabled=yes
- name: Wait for elasticsearch to startup - name: Wait for elasticsearch to startup
wait_for: host={% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %} port={% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %} delay=10 wait_for: host={{es_api_host}} port={{es_api_port}} delay=10
- set_fact: manage_native_users=false - set_fact: manage_native_users=false
@ -25,7 +25,7 @@
#List current users #List current users
- name: List Native Users - name: List Native Users
uri: uri:
url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/user url: http://{{es_api_host}}:{{es_api_port}}/_shield/user
method: GET method: GET
user: "{{es_api_basic_auth_username}}" user: "{{es_api_basic_auth_username}}"
password: "{{es_api_basic_auth_password}}" password: "{{es_api_basic_auth_password}}"
@ -46,7 +46,7 @@
#Delete all non required users #Delete all non required users
- name: Delete Native Users - name: Delete Native Users
uri: uri:
url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/user/{{item}} url: http://{{es_api_host}}:{{es_api_port}}/_shield/user/{{item}}
method: DELETE method: DELETE
status_code: 200 status_code: 200
user: "{{es_api_basic_auth_username}}" user: "{{es_api_basic_auth_username}}"
@ -59,7 +59,7 @@
#Overwrite all other users #Overwrite all other users
- name: Update Native Users - name: Update Native Users
uri: uri:
url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/user/{{item.key}} url: http://{{es_api_host}}:{{es_api_port}}/_shield/user/{{item.key}}
method: POST method: POST
body_format: json body_format: json
body: "{{item.value | to_json}}" body: "{{item.value | to_json}}"
@ -74,7 +74,7 @@
- name: List Native Roles - name: List Native Roles
uri: uri:
url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/role url: http://{{es_api_host}}:{{es_api_port}}/_shield/role
method: GET method: GET
body_format: json body_format: json
user: "{{es_api_basic_auth_username}}" user: "{{es_api_basic_auth_username}}"
@ -98,7 +98,7 @@
#Delete all non required roles #Delete all non required roles
- name: Delete Native Roles - name: Delete Native Roles
uri: uri:
url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/role/{{item}} url: http://{{es_api_host}}:{{es_api_port}}/_shield/role/{{item}}
method: DELETE method: DELETE
status_code: 200 status_code: 200
user: "{{es_api_basic_auth_username}}" user: "{{es_api_basic_auth_username}}"
@ -111,7 +111,7 @@
#Update other roles #Update other roles
- name: Update Native Roles - name: Update Native Roles
uri: uri:
url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/role/{{item.key}} url: http://{{es_api_host}}:{{es_api_port}}/_shield/role/{{item.key}}
method: POST method: POST
body_format: json body_format: json
body: "{{item.value | to_json}}" body: "{{item.value | to_json}}"