---
title: "Advanced deploy options"
description: "Advanced deploy options in Opsview allow running playbooks against specific hosts or groups using hostnames, wildcards, and Ansible tags. The FAQ explains how to limit or exclude hosts with the -l option and use tags for precise targeting."
url: "https://docs.itrsgroup.com/docs/faq/opsview/4922736823965-opsview-advanced-deploy-options/index.html"
---
## Limiting host scope

You can run playbooks against some or all [Opsview hosts](https://docs.itrsgroup.com/docs/faq/opsview/4920387360029-opsview-opsview-host/index.html). For example, you can run playbooks against only a specific [collector cluster](https://docs.itrsgroup.com/docs/faq/opsview/4920301079581-opsview-collector-cluster/index.html) or all [collectors](https://docs.itrsgroup.com/docs/faq/opsview/4919470073373-opsview-collector/index.html) except one. These powerful targeting options can speed up running playbooks by limiting them to only run against necessary hosts.

Deploy playbooks can be limited to specific hosts using the `-l` option followed by a list of hostnames or Ansible tags separated by commas and wrapped in single quotes.

### Hostnames

You can run deploy playbooks against only a list of specified hosts. Hostnames can include wildcard (\*) expansion, so `collector-fr-*` would expand to include `collector-fr-1`, `collector-fr-2`, etc.

#### Example: Run the `setup_hosts.yml` playbook against only the hosts ‘fr-col-1’, ‘de-col-2’, and ‘de-col-3’

```
/opt/opsview/deploy/bin/opsview-deploy -l 'fr-col-1,de-col-2,de-col-3' /opt/opsview/deploy/lib/playbooks/setup_hosts.yml
```

### Ansible tags

One of the most powerful ways to take advantage of limiting host scope is using Ansible tags. Follow these steps to list all available Ansible tags for your system: 1. Log in to your deployment host (usually your orchestrator) as `root`. 2. Run this source command:

```
source /opt/opsview/deploy/bin/rc.ansible
```

3. Run this `ansible-inventory` command and pipe its output to `jq`:

```
ansible-inventory  --list | jq -r '.opsview_all.children[]'
```

#### `dosh`

Alternatively, you can list available Ansible tags using the [dosh](https://docs.itrsgroup.com/docs/faq/opsview/4922950487965-opsview-dosh/index.html) support script.

```
/opt/opsview/supportscripts/bin/dosh -l
```

#### Example: Run the `setup-everything.yml` playbook against all collectors in the cluster ‘cluster\_1’

```
/opt/opsview/deploy/bin/opsview-deploy -l opsview_cluster_cluster_1 /opt/opsview/deploy/lib/playbooks/setup-everything.yml
```

#### Example: Run the `check_deploy.yml` playbook against all collectors, except ‘fr-col-1’, in the cluster ‘france’

```
/opt/opsview/deploy/bin/opsview-deploy -l 'opsview_cluster_france,!fr-col-1' /opt/opsview/deploy/lib/playbooks/check_deploy.yml
```

### Exclusions

To exclude a host or tag that would otherwise be included, include the hostname or tag preceded by an exclamation point (‘!’).

#### Example: Run the `check_deploy.yml` playbook against all collectors except those in clusters ‘cluster-fr’ and ‘cluster-de’

```
/opt/opsview/deploy/bin/opsview-deploy -l 'opsview_collector,!opsview_cluster_cluster_fr,!opsview_cluster_cluster_de' /opt/opsview/deploy/lib/playbooks/setup_hosts.yml
```

Note how the Ansible tags replace hyphens with underscores.


