ansible.builtin.sefcontext (v2.5.10) — module

Manages SELinux file context mapping definitions

| "added in version" 2.2 of ansible.builtin"

Authors: Dag Wieers (@dagwieers)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.10

Description

Manages SELinux file context mapping definitions.

Similar to the C(semanage fcontext) command.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Allow apache to modify files in /srv/git_repos
- sefcontext:
    target: '/srv/git_repos(/.*)?'
    setype: httpd_git_rw_content_t
    state: present

Inputs

    
ftype:
    default: a
    description:
    - File type.

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Desired boolean value.

reload:
    default: 'yes'
    description:
    - Reload SELinux policy after commit.
    type: bool

setype:
    description:
    - SELinux type for the specified target.
    required: true

seuser:
    description:
    - SELinux user for the specified target.

target:
    aliases:
    - path
    description:
    - Target path (expression).
    required: true

selevel:
    aliases:
    - serange
    description:
    - SELinux range for the specified target.