Update hashing tasks

This commit is contained in:
Jose M 2020-06-25 12:37:39 +02:00
parent 3c723a94ef
commit 9e9fd386f0
No known key found for this signature in database
GPG Key ID: 790179D6924E10FF

View File

@ -73,10 +73,30 @@
mode: 0644 mode: 0644
run_once: true run_once: true
- name: Hashing the custom admin password
shell: "{{ opendistro_sec_plugin_tools_path }}/hash.sh -p {{ opendistro_admin_password }}"
register: opendistro_admin_password_hashed
run_once: true
- name: Filtering hash result in case java path is not defined
set_fact:
opendistro_admin_password_hashed_filtered: "{{ opendistro_admin_password_hashed.stdout_lines[1] }}"
when:
- opendistro_admin_password_hashed.stdout_lines[1] is defined
run_once: true
- name: Setting admin hash result
set_fact:
opendistro_admin_password_hashed_filtered: "{{ opendistro_admin_password_hashed.stdout_lines[0] }}"
when:
- opendistro_admin_password_hashed.stdout_lines[1] is not defined
run_once: true
- name: Set the Admin user password - name: Set the Admin user password
shell: > replace:
sed -i 's,{{ opendistro_admin_password }},'$(sh {{ opendistro_sec_plugin_tools_path }}/hash.sh -p {{ opendistro_admin_password }} | tail -1)',' path: "{{ opendistro_sec_plugin_conf_path }}/internal_users.yml"
{{ opendistro_sec_plugin_conf_path }}/internal_users.yml regexp: '(?<=admin:\n hash: )(.*)(?=)'
replace: "\"{{ opendistro_admin_password_hashed_filtered }}\""
run_once: true run_once: true
- name: Set the kibanaserver role/user pasword - name: Set the kibanaserver role/user pasword