Merge branch 'master' into become-yes
This commit is contained in:
commit
b032eee3da
11 changed files with 223 additions and 68 deletions
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- set_fact: manage_file_users=es_users is defined and es_users.file is defined
|
||||
- set_fact: manage_file_users=es_users is defined and es_users.file is defined and es_users.file.keys() | length > 0
|
||||
|
||||
#List current users
|
||||
- name: List Users
|
||||
|
|
@ -18,12 +18,11 @@
|
|||
command: >
|
||||
{{es_home}}/bin/x-pack/users userdel {{item}}
|
||||
with_items: "{{users_to_remove | default([])}}"
|
||||
when: manage_file_users and (users_to_remove | length > 0)
|
||||
when: manage_file_users
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
ES_HOME: "{{es_home}}"
|
||||
|
||||
|
||||
- set_fact: users_to_add={{ es_users.file.keys() | difference (current_file_users.stdout_lines) }}
|
||||
when: manage_file_users
|
||||
|
||||
|
|
@ -32,8 +31,8 @@
|
|||
become: yes
|
||||
command: >
|
||||
{{es_home}}/bin/x-pack/users useradd {{item}} -p {{es_users.file[item].password}}
|
||||
with_items: "{{users_to_add | default([])}}"
|
||||
when: manage_file_users and users_to_add | length > 0
|
||||
with_items: "{{ users_to_add | default([]) }}"
|
||||
when: manage_file_users
|
||||
no_log: True
|
||||
environment:
|
||||
CONF_DIR: "{{ conf_dir }}"
|
||||
|
|
@ -43,9 +42,9 @@
|
|||
- name: Set User Passwords
|
||||
become: yes
|
||||
command: >
|
||||
{{es_home}}/bin/x-pack/users passwd {{item.key}} -p {{item.value.password}}
|
||||
with_dict: "{{(es_users | default({'file':{}})).file}}"
|
||||
when: manage_file_users and es_users.file.keys() | length > 0
|
||||
{{es_home}}/bin/x-pack/users passwd {{ item }} -p {{es_users.file[item].password}}
|
||||
with_items: "{{ es_users.file.keys() | default([]) }}"
|
||||
when: manage_file_users
|
||||
#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
|
||||
no_log: True
|
||||
|
|
@ -53,7 +52,7 @@
|
|||
CONF_DIR: "{{ conf_dir }}"
|
||||
ES_HOME: "{{es_home}}"
|
||||
|
||||
- set_fact: users_roles={{es_users.file | extract_role_users}}
|
||||
- set_fact: users_roles={{es_users.file | extract_role_users () }}
|
||||
when: manage_file_users
|
||||
|
||||
#Copy Roles files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue