Skip to content

Commit 7cb86d1

Browse files
authored
Merge pull request #248 from noelmcloughlin/fixes
selinux fcontext for postgres_database.present
2 parents 656dc4b + dddb669 commit 7cb86d1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

postgres/server/init.sls

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,29 @@ postgresql-tablespace-dir-{{ name }}:
223223
- require:
224224
- pkg: postgresql-server
225225
226+
{%- if "selinux" in grains and grains.selinux.enabled %}
227+
228+
pkg.installed:
229+
- names:
230+
- policycoreutils-python
231+
- selinux-policy-targeted
232+
- refresh: True
233+
selinux.fcontext_policy_present:
234+
- name: '{{ tblspace.directory }}(/.*)?'
235+
- sel_type: postgresql_db_t
236+
- require:
237+
- file: postgresql-tablespace-dir-{{ name }}
238+
- pkg: postgresql-tablespace-dir-{{ name }}
239+
240+
postgresql-tablespace-dir-{{ name }}-fcontext:
241+
selinux.fcontext_policy_applied:
242+
- name: {{ tblspace.directory }}
243+
- recursive: True
244+
- require:
245+
- selinux: postgresql-tablespace-dir-{{ name }}
246+
247+
{%- endif %}
248+
226249
{%- endfor %}
227250
228251
{%- if not postgres.bake_image %}

0 commit comments

Comments
 (0)