Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use ignore_selinux_state module option #194

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Essentially provide mechanisms to manage local customizations:
* Manage logins
* Manage ports

**Note:** If you want to manage SELinux customizations in `disabled` mode, you need SELinux `targeted` policy installed.

## Requirements

### Collection requirements
Expand Down
7 changes: 6 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
seboolean:
name: "{{ item.name }}"
state: "{{ item.state }}"
persistent: "{{ item.persistent | default('no') }}"
persistent: "{{ item.persistent |
default(ansible_selinux.status == 'disabled') }}"
richm marked this conversation as resolved.
Show resolved Hide resolved
ignore_selinux_state: "{{ ansible_selinux.status == 'disabled' }}"
with_items: "{{ selinux_booleans }}"

- name: Set SELinux file contexts
Expand All @@ -79,6 +81,7 @@
state: "{{ item.state | default('present') }}"
selevel: "{{ item.selevel | default(omit) }}"
seuser: "{{ item.seuser | default(omit) }}"
ignore_selinux_state: "{{ ansible_selinux.status == 'disabled' }}"
with_items: "{{ selinux_fcontexts }}"

- name: Restore SELinux labels on filesystem tree
Expand All @@ -102,6 +105,7 @@
setype: "{{ item.setype }}"
state: "{{ item.state | default('present') }}"
local: "{{ item.local | default(False) }}"
ignore_selinux_state: "{{ ansible_selinux.status == 'disabled' }}"
with_items: "{{ selinux_ports }}"

- name: Set linux user to SELinux user mapping
Expand All @@ -111,6 +115,7 @@
serange: "{{ item.serange | default('s0') }}"
state: "{{ item.state | default('present') }}"
reload: "{{ item.reload | default(False) }}"
ignore_selinux_state: "{{ ansible_selinux.status == 'disabled' }}"
with_items: "{{ selinux_logins }}"
notify: __selinux_reload_policy

Expand Down
Loading