Test fixes + ensuring node is started for templates
This commit is contained in:
parent
ab592724d8
commit
a149328ae8
10 changed files with 30 additions and 19 deletions
|
|
@ -1,4 +1,8 @@
|
|||
---
|
||||
|
||||
- name: Ensure elasticsearch is started
|
||||
service: name={{instance_init_script | basename}} state=started enabled=yes
|
||||
|
||||
- name: Wait for elasticsearch to startup
|
||||
wait_for: port={{es_api_port}} delay=10
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@
|
|||
with_fileglob:
|
||||
- "{{ es_templates_fileglob }}"
|
||||
|
||||
- name: Ensure elasticsearch is started
|
||||
service: name={{instance_init_script | basename}} state=started enabled=yes
|
||||
|
||||
- name: Wait for elasticsearch to startup
|
||||
wait_for: port={{es_api_port}} delay=10
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
shell: cat {{conf_dir}}/shield/users | awk -F':' '{print $1}'
|
||||
register: current_file_users
|
||||
when: manage_file_users
|
||||
changed_when: False
|
||||
|
||||
- set_fact: users_to_remove={{ current_file_users.stdout_lines | difference (es_users.file.keys()) }}
|
||||
when: manage_file_users
|
||||
|
|
@ -25,12 +26,15 @@
|
|||
ES_HOME: "{{es_home}}"
|
||||
|
||||
|
||||
- set_fact: users_to_add={{ es_users.file.keys() | difference (current_file_users.stdout_lines) }}
|
||||
when: manage_file_users
|
||||
|
||||
#Add users
|
||||
- name: Add Users
|
||||
command: >
|
||||
{{es_home}}/bin/shield/esusers useradd {{item.key}} -p {{item.value.password}}
|
||||
with_dict: "{{es_users.file}}"
|
||||
when: manage_file_users and es_users.file.keys() | length > 0
|
||||
{{es_home}}/bin/shield/esusers useradd {{item}} -p {{es_users.file[item].password}}
|
||||
with_items: "{{users_to_add}}"
|
||||
when: manage_file_users and users_to_add | length > 0
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
ES_HOME: "{{es_home}}"
|
||||
|
|
@ -41,6 +45,8 @@
|
|||
{{es_home}}/bin/shield/esusers passwd {{item.key}} -p {{item.value.password}}
|
||||
with_dict: "{{es_users.file}}"
|
||||
when: manage_file_users and es_users.file.keys() | length > 0
|
||||
#Currently no easy way to figure out if the password has changed or to know what it currently is so we can skip.
|
||||
changed_when: False
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
ES_HOME: "{{es_home}}"
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@
|
|||
|
||||
#TODO: 1. Skip users with no password defined or error 2. Passwords | length > 6
|
||||
|
||||
|
||||
#Ensure shield conf directory is created
|
||||
- name: Ensure shield conf directory exists
|
||||
file: path={{ conf_dir }}/shield state=directory owner={{ es_user }} group={{ es_group }}
|
||||
|
||||
#-----------------------------FILE BASED REALM----------------------------------------
|
||||
|
||||
- include: elasticsearch-shield-file.yml
|
||||
|
|
@ -43,3 +38,7 @@
|
|||
when: (es_users is defined and es_users.native is defined) or (es_roles is defined and es_roles.native is defined)
|
||||
|
||||
|
||||
#Ensure shield conf directory is created
|
||||
- name: Ensure shield conf directory exists
|
||||
file: path={{ conf_dir }}/shield state=directory owner={{ es_user }} group={{ es_group }}
|
||||
changed_when: False
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'config_spec'
|
||||
|
||||
describe 'Config Tests v 2.x' do
|
||||
include_examples 'config::init', "2.2.0"
|
||||
include_examples 'config::init', "2.3.4"
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ shared_examples 'package::init' do |es_version,plugins|
|
|||
|
||||
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
|
||||
it { should be_file }
|
||||
it { should contain 'path.plugins: /usr/share/elasticsearch/plugins/node1' }
|
||||
it { should contain 'http.port: 9200' }
|
||||
it { should contain 'transport.tcp.port: 9300' }
|
||||
it { should contain 'discovery.zen.ping.unicast.hosts: localhost:9300' }
|
||||
|
|
@ -66,14 +65,14 @@ shared_examples 'package::init' do |es_version,plugins|
|
|||
end
|
||||
end
|
||||
|
||||
describe file('/usr/share/elasticsearch/plugins/node1') do
|
||||
describe file('/usr/share/elasticsearch/plugins') do
|
||||
it { should be_directory }
|
||||
it { should be_owned_by 'elasticsearch' }
|
||||
end
|
||||
|
||||
|
||||
for plugin in plugins
|
||||
describe file('/usr/share/elasticsearch/plugins/node1/'+plugin) do
|
||||
describe file('/usr/share/elasticsearch/plugins/'+plugin) do
|
||||
it { should be_directory }
|
||||
it { should be_owned_by 'elasticsearch' }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require 'multi_spec'
|
|||
|
||||
|
||||
describe 'Multi Tests v 2.x' do
|
||||
include_examples 'multi::init', "2.2.0", ["kopf","license","marvel-agent"]
|
||||
include_examples 'multi::init', "2.3.4", ["kopf","license","marvel-agent"]
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ require 'package_spec'
|
|||
|
||||
|
||||
describe 'Package Tests v 2.x' do
|
||||
include_examples 'package::init', "2.2.0", ["kopf","license","marvel-agent"]
|
||||
include_examples 'package::init', "2.3.4", ["kopf","license","marvel-agent"]
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@ require 'standard_spec'
|
|||
|
||||
|
||||
describe 'Standard Tests v 2.x' do
|
||||
include_examples 'standard::init', "2.2.0"
|
||||
include_examples 'standard::init', "2.3.4"
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Elasticsearch Xpack tests
|
||||
hosts: localhost
|
||||
hosts: localhostpost
|
||||
roles:
|
||||
- { role: elasticsearch, es_config: { "http.port": 9200, "transport.tcp.port":9300, discovery.zen.ping.unicast.hosts: "localhost:9300" }, es_instance_name: "shield_node" }
|
||||
vars:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue