clean es_xpack_conf_subdir variable
This variable was added to manage specific x-pack dir with version < 6.3
This commit is contained in:
parent
abaf124639
commit
0f601259c6
4 changed files with 11 additions and 12 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
- name: Set the defaults here otherwise they can't be overriden in the same play if the role is called twice
|
- name: Set the defaults here otherwise they can't be overriden in the same play if the role is called twice
|
||||||
set_fact:
|
set_fact:
|
||||||
es_xpack_conf_subdir: ""
|
|
||||||
es_repo_name: "{{ es_major_version }}"
|
es_repo_name: "{{ es_major_version }}"
|
||||||
es_xpack_users_command: "elasticsearch-users"
|
es_xpack_users_command: "elasticsearch-users"
|
||||||
es_package_name: "elasticsearch"
|
es_package_name: "elasticsearch"
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
force: no # only copy it if the new path doesn't exist yet
|
force: no # only copy it if the new path doesn't exist yet
|
||||||
src: "{{ es_conf_dir }}/x-pack/users"
|
src: "{{ es_conf_dir }}/x-pack/users"
|
||||||
dest: "{{ es_conf_dir }}{{ es_xpack_conf_subdir }}/users"
|
dest: "{{ es_conf_dir }}/users"
|
||||||
when: old_users_file.stat.exists
|
when: old_users_file.stat.exists
|
||||||
|
|
||||||
- name: Create the users file if it doesn't exist
|
- name: Create the users file if it doesn't exist
|
||||||
copy:
|
copy:
|
||||||
content: ""
|
content: ""
|
||||||
dest: "{{ es_conf_dir }}{{ es_xpack_conf_subdir }}/users"
|
dest: "{{ es_conf_dir }}/users"
|
||||||
force: no # this ensures it only creates it if it does not exist
|
force: no # this ensures it only creates it if it does not exist
|
||||||
group: "{{ es_group }}"
|
group: "{{ es_group }}"
|
||||||
owner: "{{ es_user }}"
|
owner: "{{ es_user }}"
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#List current users
|
#List current users
|
||||||
- name: List Users
|
- name: List Users
|
||||||
become: yes
|
become: yes
|
||||||
shell: cat {{ es_conf_dir }}{{es_xpack_conf_subdir}}/users | awk -F':' '{print $1}'
|
shell: cat {{ es_conf_dir }}/users | awk -F':' '{print $1}'
|
||||||
register: current_file_users
|
register: current_file_users
|
||||||
when: manage_file_users
|
when: manage_file_users
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
@ -89,16 +89,16 @@
|
||||||
#Copy Roles files
|
#Copy Roles files
|
||||||
- name: Copy roles.yml File for Instance
|
- name: Copy roles.yml File for Instance
|
||||||
become: yes
|
become: yes
|
||||||
template: src=security/roles.yml.j2 dest={{ es_conf_dir }}{{es_xpack_conf_subdir}}/roles.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
template: src=security/roles.yml.j2 dest={{ es_conf_dir }}/roles.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
||||||
when: es_roles is defined and es_roles.file is defined
|
when: es_roles is defined and es_roles.file is defined
|
||||||
|
|
||||||
#Overwrite users_roles file
|
#Overwrite users_roles file
|
||||||
- name: Copy User Roles
|
- name: Copy User Roles
|
||||||
become: yes
|
become: yes
|
||||||
template: src=security/users_roles.j2 dest={{ es_conf_dir }}{{es_xpack_conf_subdir}}/users_roles mode=0644 force=yes
|
template: src=security/users_roles.j2 dest={{ es_conf_dir }}/users_roles mode=0644 force=yes
|
||||||
when: manage_file_users and users_roles | length > 0
|
when: manage_file_users and users_roles | length > 0
|
||||||
|
|
||||||
#Set permission on security directory. E.g. if 2 nodes are installed on the same machine, the second node will not get the users file created at install, causing the files being created at es_users call and then having the wrong Permissions.
|
#Set permission on security directory. E.g. if 2 nodes are installed on the same machine, the second node will not get the users file created at install, causing the files being created at es_users call and then having the wrong Permissions.
|
||||||
- name: Set Security Directory Permissions Recursive
|
- name: Set Security Directory Permissions Recursive
|
||||||
become: yes
|
become: yes
|
||||||
file: state=directory path={{ es_conf_dir }}{{es_xpack_conf_subdir}}/ owner={{ es_user }} group={{ es_group }} recurse=yes
|
file: state=directory path={{ es_conf_dir }}/ owner={{ es_user }} group={{ es_group }} recurse=yes
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#Ensure x-pack conf directory is created if necessary
|
#Ensure x-pack conf directory is created if necessary
|
||||||
- name: Ensure x-pack conf directory exists (file)
|
- name: Ensure x-pack conf directory exists (file)
|
||||||
file: path={{ es_conf_dir }}{{ es_xpack_conf_subdir }} state=directory owner={{ es_user }} group={{ es_group }}
|
file: path={{ es_conf_dir }} state=directory owner={{ es_user }} group={{ es_group }}
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: (es_users is defined and es_users.file is defined) or (es_roles is defined and es_roles.file is defined) or (es_role_mapping is defined)
|
when: (es_users is defined and es_users.file is defined) or (es_roles is defined and es_roles.file is defined) or (es_role_mapping is defined)
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
#Copy Roles files
|
#Copy Roles files
|
||||||
- name: Copy role_mapping.yml File for Instance
|
- name: Copy role_mapping.yml File for Instance
|
||||||
become: yes
|
become: yes
|
||||||
template: src=security/role_mapping.yml.j2 dest={{ es_conf_dir }}{{es_xpack_conf_subdir}}/role_mapping.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
template: src=security/role_mapping.yml.j2 dest={{ es_conf_dir }}/role_mapping.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
|
||||||
when: es_role_mapping is defined
|
when: es_role_mapping is defined
|
||||||
|
|
||||||
#------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ vars = JSON.parse(File.read('/tmp/vars.json'))
|
||||||
|
|
||||||
shared_examples 'xpack_upgrade::init' do |vars|
|
shared_examples 'xpack_upgrade::init' do |vars|
|
||||||
#Test users file, users_roles and roles.yml
|
#Test users file, users_roles and roles.yml
|
||||||
describe file("/etc/elasticsearch/#{vars['es_xpack_conf_subdir']}/users_roles") do
|
describe file("/etc/elasticsearch/users_roles") do
|
||||||
it { should be_owned_by 'elasticsearch' }
|
it { should be_owned_by 'elasticsearch' }
|
||||||
it { should contain 'admin:es_admin' }
|
it { should contain 'admin:es_admin' }
|
||||||
it { should contain 'power_user:testUser' }
|
it { should contain 'power_user:testUser' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file("/etc/elasticsearch/#{vars['es_xpack_conf_subdir']}/users") do
|
describe file("/etc/elasticsearch/users") do
|
||||||
it { should be_owned_by 'elasticsearch' }
|
it { should be_owned_by 'elasticsearch' }
|
||||||
it { should contain 'testUser:' }
|
it { should contain 'testUser:' }
|
||||||
it { should contain 'es_admin:' }
|
it { should contain 'es_admin:' }
|
||||||
|
|
@ -36,7 +36,7 @@ shared_examples 'xpack_upgrade::init' do |vars|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Test contents of role_mapping.yml
|
#Test contents of role_mapping.yml
|
||||||
describe file("/etc/elasticsearch/#{vars['es_xpack_conf_subdir']}/role_mapping.yml") do
|
describe file("/etc/elasticsearch/role_mapping.yml") do
|
||||||
it { should be_owned_by 'elasticsearch' }
|
it { should be_owned_by 'elasticsearch' }
|
||||||
it { should contain 'power_user:' }
|
it { should contain 'power_user:' }
|
||||||
it { should contain '- cn=admins,dc=example,dc=com' }
|
it { should contain '- cn=admins,dc=example,dc=com' }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue