Use the correct task to set the selinux context.

This commit is contained in:
Andrea Dell'Amico 2020-07-31 13:07:47 +02:00
parent dcfbe46af5
commit ac61ee1777
1 changed files with 16 additions and 4 deletions

View File

@ -87,8 +87,14 @@
creates: '{{ psql_el_data_dir }}/base'
when: postgresql_data_dir.stat.isdir is not defined
- name: Fix the SELinux rules
shell: semanage fcontext -a -a -t postgresql_db_t "{{ psql_el_base_dir }}(/.*)?" && restorecon -vR {{ psql_el_base_dir }}
- name: Fix the SELinux context for the new data directory
sefcontext:
target: '{{ psql_el_base_dir }}(/.*)?'
setype: postgresql_db_t
state: present
- name: Restore the SELinux context
command: restorecon -vR {{ psql_el_base_dir }}
- name: Start the postgresql service that will use the new data directory
service: name='postgresql-{{ psql_version }}' state=started
@ -105,8 +111,14 @@
- name: Create the postgresql log directory
file: dest={{ psql_log_dir }} state=directory owner=postgres group=postgres mode='0750'
- name: Fix the SELinux rules for the postgresql log directory
shell: semanage fcontext -a -a -t postgresql_db_t "{{ psql_log_dir }}(/.*)?" && restorecon -vR {{ psql_log_dir }}
- name: Fix the SELinux context for the postgresql log directory
sefcontext:
target: '{{ psql_log_dir }}(/.*)?'
setype: postgresql_db_t
state: present
- name: Fix the SELinux context for the postgresql log directory
command: restorecon -vR {{ psql_log_dir }}
- name: Set some postgresql configuration parameters that require a db restart
become: True