Added support for optionally creating the elasticsearch user and group before installing elasticsearch.

Renamed vars, set the tasks to use the es_user and es_group vars in elasticsearch-optional-user.yml. Modifed README.md to list the es_user_id and es_group_id vars, made note that both vars are required if they are used. Removed the commented out instances of the vars in defaults/main.yml.

Added es_user, es_group, es_user_id, es_group_id vars to config testing.

Made conditionals use explicit 'is defined' test.

Add tests for es_user_id and es_group_id.

Update defaults/main.yml and test/integration/config.yml to match master plus test config additions.
This commit is contained in:
David Reagan 2016-01-22 12:14:09 -08:00
parent e62af4a786
commit 8393b86a27
5 changed files with 35 additions and 1 deletions

View file

@ -4,7 +4,7 @@
hosts: localhost
roles:
#expand to all available parameters
- { role: elasticsearch, es_instance_name: "node1", es_data_dirs: ["/opt/elasticsearch/data-1","/opt/elasticsearch/data-2"], es_log_dir: "/opt/elasticsearch/logs", es_work_dir: "/opt/elasticsearch/temp", es_config: {node.name: "node1", cluster.name: "custom-cluster", discovery.zen.ping.unicast.hosts: "localhost:9301", http.port: 9201, transport.tcp.port: 9301, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } }
- { role: elasticsearch, es_instance_name: "node1", es_data_dirs: ["/opt/elasticsearch/data-1","/opt/elasticsearch/data-2"], es_log_dir: "/opt/elasticsearch/logs", es_work_dir: "/opt/elasticsearch/temp", es_user_id: 333, es_group_id: 333, es_config: {node.name: "node1", cluster.name: "custom-cluster", discovery.zen.ping.unicast.hosts: "localhost:9301", http.port: 9201, transport.tcp.port: 9301, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } }
vars:
es_scripts: false
es_templates: false

View file

@ -5,6 +5,14 @@ shared_examples 'config::init' do |es_version|
describe user('elasticsearch') do
it { should exist }
end
describe group('elasticsearch') do
it { should have_gid 333 }
end
describe user('elasticsearch') do
it { should have_uid 333 }
end
describe service('node1_elasticsearch') do
it { should be_running }