add xpack license activation tests
This commit is contained in:
parent
fbbb06111d
commit
61a3ba32c5
4 changed files with 49 additions and 36 deletions
36
tasks/xpack/elasticsearch-xpack-activation.yml
Normal file
36
tasks/xpack/elasticsearch-xpack-activation.yml
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
- name: Activate ES license (without shield authentication)
|
||||||
|
uri:
|
||||||
|
method: PUT
|
||||||
|
url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true"
|
||||||
|
body_format: json
|
||||||
|
body: "{{ es_xpack_license }}"
|
||||||
|
return_content: yes
|
||||||
|
register: license_activated
|
||||||
|
no_log: True
|
||||||
|
when: '"shield" not in es_xpack_features
|
||||||
|
failed_when: >
|
||||||
|
license_activated.status != 200 or
|
||||||
|
license_activated.json.license_status is not defined or
|
||||||
|
license_activated.json.license_status != 'valid'
|
||||||
|
|
||||||
|
- name: Activate ES license (with shield authentication)
|
||||||
|
uri:
|
||||||
|
method: PUT
|
||||||
|
url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true"
|
||||||
|
user: "{{es_api_basic_auth_username}}"
|
||||||
|
password: "{{es_api_basic_auth_password}}"
|
||||||
|
body_format: json
|
||||||
|
force_basic_auth: yes
|
||||||
|
body: "{{ es_xpack_license }}"
|
||||||
|
return_content: yes
|
||||||
|
register: license_activated
|
||||||
|
no_log: True
|
||||||
|
when: '"shield" in es_xpack_features
|
||||||
|
failed_when: >
|
||||||
|
license_activated.status != 200 or
|
||||||
|
license_activated.json.license_status is not defined or
|
||||||
|
license_activated.json.license_status != 'valid'
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "License: {{ license_activated.content }}"
|
||||||
|
|
@ -50,42 +50,8 @@
|
||||||
- include: shield/elasticsearch-shield.yml
|
- include: shield/elasticsearch-shield.yml
|
||||||
|
|
||||||
# Activate ES lience
|
# Activate ES lience
|
||||||
- name: Activate ES license (without shield authentication)
|
- include: elasticsearch-xpack-activation.yml
|
||||||
uri:
|
when: es_enable_xpack and es_xpack_license is defined and es_xpack_license != ''
|
||||||
method: PUT
|
|
||||||
url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true"
|
|
||||||
body_format: json
|
|
||||||
body: "{{ es_xpack_license }}"
|
|
||||||
return_content: yes
|
|
||||||
register: license_activated
|
|
||||||
no_log: True
|
|
||||||
when: es_xpack_license is defined and es_xpack_license != '' and es_enable_xpack and '"shield" not in es_xpack_features
|
|
||||||
failed_when: >
|
|
||||||
license_activated.status != 200 or
|
|
||||||
license_activated.json.license_status is not defined or
|
|
||||||
license_activated.json.license_status != 'valid'
|
|
||||||
|
|
||||||
- name: Activate ES license (with shield authentication)
|
|
||||||
uri:
|
|
||||||
method: PUT
|
|
||||||
url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true"
|
|
||||||
user: "{{es_api_basic_auth_username}}"
|
|
||||||
password: "{{es_api_basic_auth_password}}"
|
|
||||||
body_format: json
|
|
||||||
force_basic_auth: yes
|
|
||||||
body: "{{ es_xpack_license }}"
|
|
||||||
return_content: yes
|
|
||||||
register: license_activated
|
|
||||||
no_log: True
|
|
||||||
when: es_xpack_license is defined and es_xpack_license != '' and es_enable_xpack and '"shield" in es_xpack_features
|
|
||||||
failed_when: >
|
|
||||||
license_activated.status != 200 or
|
|
||||||
license_activated.json.license_status is not defined or
|
|
||||||
license_activated.json.license_status != 'valid'
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "License: {{ license_activated.content }}"
|
|
||||||
when: es_xpack_license is defined and es_xpack_license != '' and es_enable_xpack
|
|
||||||
|
|
||||||
#Add any feature specific configuration here
|
#Add any feature specific configuration here
|
||||||
- name: Set Plugin Directory Permissions
|
- name: Set Plugin Directory Permissions
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,16 @@ shared_examples 'xpack::init' do |es_version|
|
||||||
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true -u es_admin:changeMe | grep license') do
|
describe command('curl -s localhost:9200/_nodes/plugins?pretty=true -u es_admin:changeMe | grep license') do
|
||||||
its(:exit_status) { should eq 0 }
|
its(:exit_status) { should eq 0 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Test if x-pack is activated
|
||||||
|
describe 'x-pack activation' do
|
||||||
|
it 'should be activated with the license uid '+ENV["ES_XPACK_LICENSE_UID"] do
|
||||||
|
command = command('curl -s localhost:9200/_xpack/license?pretty=true -u es_admin:changeMe')
|
||||||
|
expect(command.stdout).to match(active)
|
||||||
|
expect(command.stdout).to match(ENV["ES_XPACK_LICENSE_UID"])
|
||||||
|
expect(command.exit_status).to eq(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe file('/usr/share/elasticsearch/plugins/shield') do
|
describe file('/usr/share/elasticsearch/plugins/shield') do
|
||||||
it { should be_directory }
|
it { should be_directory }
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
vars:
|
vars:
|
||||||
es_templates: true
|
es_templates: true
|
||||||
es_enable_xpack: true
|
es_enable_xpack: true
|
||||||
|
es_xpack_license: <%= ENV['ES_XPACK_LICENSE'] %>
|
||||||
es_plugins:
|
es_plugins:
|
||||||
- plugin: lmenezes/elasticsearch-kopf
|
- plugin: lmenezes/elasticsearch-kopf
|
||||||
version: master
|
version: master
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue