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
|
|
@ -10,8 +10,9 @@
|
|||
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() ) }}
|
||||
- set_fact: users_to_remove={{ current_file_users.stdout_lines | difference (es_users.file.keys()) }}
|
||||
when: manage_file_users
|
||||
|
||||
#Remove 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue