25.3. Automember グループの使用例
注記
これらの例は CLI を使用して示しています。同じ設定は Web UI で実行できます。
デフォルトグループの作成に関する注意事項
一般的な環境要件の 1 つに、ユーザーまたはホストを追加するデフォルトグループがあります。これには、いくつかの方法があります。
- すべてのエントリーを 1 つのグローバルグループに追加できます。追加先の他のグループに関係なく、すべてのエントリーを単一のグローバルグループに追加できます。
- エントリーは、特定の automember グループに追加できます。新しいエントリーが autogroup に一致しない場合は、デフォルトまたはフォールバックグループに追加されます。
これらのストラテジーは相互排他的です。エントリーがグローバルグループと一致する場合は、automember グループと一致するため、フォールバックグループに追加されません。
25.3.1. 全ユーザー/ホストルールの設定
すべてのユーザーまたはすべてのホストを 1 つのグループに追加するには、すべてのエントリーに含まれる属性 (
cn
または fqdn
など) に含まれる正規表現を使用します。
すべてのエントリーに一致する正規表現は、単に .* を使用します 。たとえば、すべてのホストを同じホストグループに追加するには、次のコマンドを実行します。
ipa automember-add-condition --type=hostgroup allhosts --inclusive-regex=.* --key=fqdn
[jsmith@server ~]$ ipa automember-add-condition --type=hostgroup allhosts --inclusive-regex=.* --key=fqdn
--------------------------------
Added condition(s) to "allhosts"
--------------------------------
Automember Rule: allhosts
Inclusive Regex: fqdn=.*
----------------------------
Number of conditions added 1
----------------------------
その後に追加したすべてのホストが、自動的に allhosts グループに追加されます。
ipa host-add test.example.com ipa hostgroup-show allhosts
[jsmith@server ~]$ ipa host-add test.example.com
-----------------------------
Added host "test.example.com"
-----------------------------
Host name: test.example.com
Principal name: host/test.example.com@EXAMPLE.COM
Password: False
Keytab: False
Managed by: test.example.com
[jsmith@server ~]$ ipa hostgroup-show allhosts
Host-group: allhosts
Description: Default hostgroup
Member hosts: test.example.com
PCRE パターンの詳細は、pcresyntax(3) の man ページを参照してください。