Skip to content

Host Group

add_host_to_hostgroup

add_host_to_hostgroup <HOSTS> <HOSTGROUPS> [OPTIONS]

Add hosts to host groups.

Host name and group arguments are interpreted as IDs if they are numeric.

Examples

Add a host to a host group

add_host_to_hostgroup 'My host' 'My host group'

Add multiple hosts to a host group

add_host_to_hostgroup 'host1,host2' 'My host group'

Add multiple hosts to multiple host groups

add_host_to_hostgroup 'host1,host2' 'My host group,Another group'

Arguments

HOSTS
Host names or IDs. Comma-separated. Supports wildcards.
Type: text
Required:

HOSTGROUPS
Host group names or IDs. Comma-separated. Supports wildcards.
Type: text
Required:

Options

--dryrun
Preview changes
Type: boolean
Default: False


create_hostgroup

create_hostgroup <HOSTGROUP> [OPTIONS]

Create a new host group.

Assigns default user group permissions by default.

  • --rw-groups defaults to config option app.default_admin_usergroups.
  • --ro-groups defaults to config option app.default_create_user_usergroups.
  • Use --no-usergroup-permissions to create a group without any user group permissions.

Examples

Create a host group with default user group permissions

create_hostgroup 'My Host Group'

Create a host group with specific RO and RW groups

create_hostgroup 'My Host Group' --ro-groups users --rw-groups admins

Create a host group with no user group permissions

create_hostgroup 'My Host Group' --no-usergroup-permissions

Arguments

HOSTGROUP
Name of host group.
Type: text
Required:

Options

--rw-groups <RW_GROUPS>
User group(s) to give read/write permissions. Comma-separated.
Type: text

--ro-groups <RO_GROUPS>
User group(s) to give read-only permissions. Comma-separated.
Type: text

--no-usergroup-permissions
Do not assign user group permissions.
Type: boolean
Default: False


extend_hostgroup

extend_hostgroup <SRC_GROUP> <DEST_GROUP> [OPTIONS]

Add all hosts from a host group to other host groups.

The source group is not modified. Existing hosts in the destination group(s) are not removed or modified.

Arguments

SRC_GROUP
Group to get hosts from.
Type: text
Required:

DEST_GROUP
Group(s) to add hosts to. Comma-separated. Supports wildcards.
Type: text
Required:

Options

--dryrun
Show hosts and groups without making changes.
Type: boolean
Default: False


move_hosts

move_hosts <SRC_GROUP> <DEST_GROUP> [OPTIONS]

Move all hosts from one host group to another.

Arguments

SRC_GROUP
Group to move hosts from.
Type: text
Required:

DEST_GROUP
Group to move hosts to.
Type: text
Required:

Options

--rollback/--no-rollback
Rollback changes if hosts cannot be removed from source group afterwards.
Type: boolean
Default: True

--dryrun
Show hosts and groups without making changes.
Type: boolean
Default: False


remove_host_from_hostgroup

remove_host_from_hostgroup <HOSTS> <HOSTGROUPS> [OPTIONS]

Remove hosts from host groups.

Examples

Remove a host to a host group

remove_host_from_hostgroup 'My host' 'My host group'

Remove multiple hosts from a host group

remove_host_from_hostgroup 'host1,host2' 'My host group'

Remove multiple hosts from multiple host groups

remove_host_from_hostgroup 'host1,host2' 'My host group,Another group'

Arguments

HOSTS
Host names or IDs. Comma-separated. Supports wildcards.
Type: text
Required:

HOSTGROUPS
Host group names or IDs. Comma-separated. Supports wildcards.
Type: text
Required:

Options

--dryrun
Preview changes
Type: boolean
Default: False


remove_hostgroup

remove_hostgroup <HOSTGROUP> [OPTIONS]

Delete a host group.

Arguments

HOSTGROUP
Name of host group(s) to delete. Comma-separated.
Type: text
Required:

Options

--force
Remove host group even if it contains hosts.
Type: boolean
Default: False


show_hostgroup

show_hostgroup <HOSTGROUP>

Show details of a host group.

Arguments

HOSTGROUP
Name of host group.
Type: text
Required:


show_hostgroup_permissions

show_hostgroup_permissions <HOSTGROUPS>

Show usergroups with permissions for the given hostgroup.

Shows permissions for all host groups by default.

Arguments

HOSTGROUPS
Host group name(s). Comma-separated. Supports wildcards.
Type: text
Required:


show_hostgroups

show_hostgroups <NAME> [OPTIONS]

Show details for host groups.

Limits results to 20 by default. Fetching all host groups with hosts can be extremely slow.

Examples

Show all host groups

show_hostgroups --limit 0

Show all host groups starting with 'Web-'

show_hostgroups 'Web-*'

Show host groups with 'web' in the name

show_hostgroups '*web*'

Arguments

NAME
Name of host group(s). Comma-separated. Supports wildcards.
Type: text
Required:

Options

--hosts/--no-hosts
Show hosts in each host group.
Type: boolean
Default: True

--limit, -n <LIMIT>
Limit the number of results. 0 to show all.
Type: integer
Default: 0