FlatKey.selinux
ansible-selinux-role
SELinuxの設定を行うためのものです。
設定オプション:
- ポリシー
- ステート
- ブール値
- ポート
- ファイルコンテキスト
要件
RHEL 7とCentOS 7のみでテスト済みです。
Ansible 2.0以上が必要です。
ロール変数
これらの変数のすべてを使用する必要はありません。本当に必要な設定オプションだけを使用できます。
以下の変数はSELinuxのポリシーと状態を設定するために使用されます:
selinux_config: (オプション、デフォルト: /etc/selinux/config)
selinux_policy: (オプション、デフォルト: targeted)
selinux_state: (オプション、値は: enforcing|permissive|disabled のみ、デフォルト: enforcing)
以下の変数はSELinuxのブール値を切り替えるために使用されます:
selinux_boolean:
name_of_selinux_boolean:
state: (オプション、値は: yes|no のみ、デフォルト: yes)
persistent: (オプション、値は: yes|no のみ、デフォルト: yes)
以下の変数はSELinuxポートを設定するために使用されます:
selinux_ports:
name_of_selinux_type:
ports: (必須、ポートまたはポート範囲)
protocol: (オプション、値は: tcp|udp のみ、デフォルト: tcp)
state: (オプション、値は: present|absent のみ、デフォルト: present)
以下の変数はSELinuxファイルコンテキストを設定するために使用されます:
selinux_fcontext:
name_of_selinux_fcontext: (より良いドキュメンテーションのための自分の選択)
file_spec: (必須、影響を受けるファイルを説明する正規表現)
setype: (必須、ファイルをラベル付けするための既存のSELinuxタイプ)
ftype: (オプション、値は: a|b|c|d|f|l|p|s - manページのsemanage-fcontextを参照、デフォルト: a - すべてのファイル)
state: (オプション、値は: present|absent のみ、デフォルト: present)
例のプレイブック
- hosts: server
become: yes
become_user: root
become_method: su
roles:
- { role: ansible-selinux-role }
vars:
selinux_policy: "targeted"
selinux_state: "enforcing"
selinux_boolean:
antivirus_can_scan_system:
state: yes
persistent: yes
httpd_can_sendmail:
state: yes
persistent: yes
selinux_ports:
ssh_port_t:
ports: 2222
protocol: tcp
state: present
http_port_t:
ports: 9000-9004
protocol: tcp
state: present
selinux_fcontext:
vcloud_documentroot:
file_spec: "/srv/www(.*)"
setype: httpd_sys_rw_content_t
ftype: a
state: present
ライセンス
MIT