43.5. Adding IdM host group members using the CLI
You can add hosts as well as host groups as members to an IdM host group using a single command.
Prerequisites
- Administrator privileges for managing IdM or User Administrator role.
- An active Kerberos ticket. For details, see Using kinit to log in to IdM manually.
-
Optional: Use the
ipa hostgroup-findcommand to find hosts and host groups.
Procedure
To add a member to a host group, use the
ipa hostgroup-add-membercommand and provide the relevant information. You can specify the type of member to add using these options:Use the
--hostsoption to add one or more hosts to an IdM host group.For example, to add the host named example_member to the group named group_name:
$ ipa hostgroup-add-member group_name --hosts example_member Host-group: group_name Description: My host group Member hosts: example_member ------------------------- Number of members added 1 -------------------------Use the
--hostgroupsoption to add one or more host groups to an IdM host group.For example, to add the host group named nested_group to the group named group_name:
$ ipa hostgroup-add-member group_name --hostgroups nested_group Host-group: group_name Description: My host group Member host-groups: nested_group ------------------------- Number of members added 1 -------------------------You can add multiple hosts and multiple host groups to an IdM host group in one single command using the following syntax:
$ ipa hostgroup-add-member group_name --hosts={host1,host2} --hostgroups={group1,group2}
重要When adding a host group as a member of another host group, do not create recursive groups. For example, if Group A is a member of Group B, do not add Group B as a member of Group A. Recursive groups can cause unpredictable behavior.