Skip to content

Commit

Permalink
Make xpack elasticsearch role idempotent (elastic#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
liza-mae committed Aug 30, 2018
1 parent 583e798 commit b13a4cb
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
---


- name: Check if password is set
block:
- name: Elasticsearch HTTPS GET ?pretty
uri:
url: "https://{{ current_host_ip }}:{{ elasticsearch_port }}/?pretty"
method: GET
user: "{{ elasticsearch_username }}"
password: "{{ elasticsearch_password }}"
validate_certs: no
return_content: yes
status_code: 200, 401
register: elastic_user_auth
- debug:
msg: '{{ elastic_user_auth }}'

- name: Check if setup passwords executable exists
stat:
path: '{{ elasticsearch_setup_passwords_exe }}'
Expand All @@ -16,7 +31,8 @@
echo 'y' | {{ elasticsearch_setup_passwords_exe }} auto
register: initial_passwords
when: file_setup_passwords.stat.exists is defined and file_setup_passwords.stat.exists and
file_setup_passwords.stat.executable is defined and file_setup_passwords.stat.executable
file_setup_passwords.stat.executable is defined and file_setup_passwords.stat.executable and
elastic_user_auth.status == 401

- debug:
msg: '{{ initial_passwords }}'
Expand Down

0 comments on commit b13a4cb

Please sign in to comment.