community.general.selogin 模块 – 管理 Linux 用户到 SELinux 用户的映射
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在剧本中使用它,请指定:community.general.selogin。
概要
- 管理 Linux 用户到 SELinux 用户的映射 
要求
执行此模块的主机需要以下要求。
- libselinux 
- policycoreutils 
参数
| 参数 | 注释 | 
|---|---|
| 独立于 selinux 运行时状态运行 选项 
 | |
| 一个 Linux 用户 | |
| 提交后重新加载 SELinux 策略。 选项 
 | |
| MLS/MCS 安全范围 (仅限 MLS/MCS 系统) SELinux 范围用于 SELinux 登录映射,默认为 SELinux 用户记录范围。 默认值:  | |
| SELinux 用户名 | |
| 所需的映射值。 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在  | |
| 支持:不支持 | 在差异模式下,将返回有关已更改内容(或可能需要在  | 
备注
注意
- 这些更改在重新引导后仍然有效 
- 未在任何基于 Debian 的系统上测试 
示例
- name: Modify the default user on the system to the guest_u user
  community.general.selogin:
    login: __default__
    seuser: guest_u
    state: present
- name: Assign gijoe user on an MLS machine a range and to the staff_u user
  community.general.selogin:
    login: gijoe
    seuser: staff_u
    serange: SystemLow-Secret
    state: present
- name: Assign all users in the engineering group to the staff_u user
  community.general.selogin:
    login: '%engineering'
    seuser: staff_u
    state: present
