robertdebock.selinux

Ansible Role for SELinux

This role installs and configures SELinux along with the necessary libraries on your system.

GitHub GitLab Downloads Version
github gitlab downloads Version

Example Playbook

Here is a simple example taken from molecule/default/converge.yml. This example is tested each time there is a push, pull request, or release.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.selinux
      selinux_reboot: false
      selinux_booleans:
        - name: http_can_network_connect
        - name: abrt_anon_write
          state: false
          persistent: false

Before running the playbook, the machine needs to be prepared. In CI, this is done using molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap

For more details, see a full explanation and example on how to use these roles.

Role Variables

Default values for the variables can be found in defaults/main.yml:

---
# defaults file for selinux

# State can be disabled, permissive, or enforcing.
selinux_state: enforcing

# The policy varies by distribution.
selinux_policy: "{{ _selinux_policy[ansible_os_family] | default(_selinux_policy['default']) }}"

# Should the machine reboot after changes?
selinux_reboot: true

# Enable or disable booleans by putting them in this list.
# selinux_booleans:
#   - name: http_can_network_connect
#   - name: abrt_anon_write
#     state: false
#     persistent: false

Requirements

State of Used Roles

The roles mentioned below are used to prepare a system. You can prepare your system differently if needed.

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab

Context

This role is part of many compatible roles. You can check the documentation of these roles for more information.

Here’s a visual overview of related roles: dependencies

Compatibility

This role has been tested on these container images:

Container Tags
Alpine all
Amazon Candidate
EL 9
Debian all
Fedora all
Ubuntu all

You need at least Ansible version 2.12. Tests have been conducted on:

  • The previous version.
  • The current version.
  • The development version.

If you encounter issues, please report them on GitHub.

License

This role is licensed under Apache-2.0.

Author Information

This role is created by robertdebock.

If you like what you see, consider sponsoring me.

Informazioni sul progetto

Install and configure selinux and its required libraries on your system.

Installa
ansible-galaxy install robertdebock.selinux
Licenza
apache-2.0
Download
366.9k
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.