Merge pull request #270 from wazuh/feature-add-elasticsearch-users

New task to create elasticsearch users
This commit is contained in:
Manuel J. Bernal 2019-10-04 17:16:37 +02:00 committed by GitHub
commit 35c5cdf458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -79,6 +79,13 @@ Example Playbook
node_certs_generator_ip: 172.16.0.111 node_certs_generator_ip: 172.16.0.111
vars: vars:
elasticsearch_xpack_users:
anne:
password: 'PasswordHere'
roles: '["kibana_user", "monitoring_user"]'
jack:
password: 'PasswordHere'
roles: '["superuser"]'
instances: instances:
node-1: node-1:
name: node-1 name: node-1

View File

@ -194,3 +194,19 @@
when: when:
- node_certs_generator - node_certs_generator
tags: molecule-idempotence-notest tags: molecule-idempotence-notest
- name: Create elasticsearch users
uri:
url: "https://{{ elasticsearch_reachable_host }}:9200/_security/user/{{ item.key }}"
method: POST
body_format: json
user: "{{ elasticsearch_xpack_security_user }}"
password: "{{ elasticsearch_xpack_security_password }}"
body: '{ "password" : "{{ item.value["password"] }}", "roles" : {{ item.value["roles"] }} }'
validate_certs: no
loop: "{{ elasticsearch_xpack_users|default({})|dict2items }}"
register: http_response
failed_when: http_response.status != 200
when:
- elasticsearch_xpack_users is defined
- node_certs_generator