Skip to content

Commit

Permalink
doc: Update doc accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
titom73 committed Nov 20, 2023
1 parent d246e51 commit b5fa87b
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions docs/cli/inv-from-ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ In large setups, it might be beneficial to construct your inventory based on you
### Command overview

```bash
anta get from-ansible --help
$ anta get from-ansible --help
Usage: anta get from-ansible [OPTIONS]

Build ANTA inventory from an ansible inventory YAML file

Options:
-g, --ansible-group TEXT Ansible group to filter
-i, --ansible-inventory FILENAME
Path to your ansible inventory file to read
-o, --output FILENAME Path to save inventory file
-d, --inventory-directory PATH Directory to save inventory file
--help Show this message and exit.
-g, --ansible-group TEXT Ansible group to filter
-i, --ansible-inventory FILE Path to your ansible inventory file to read
-o, --output FILE Path to save inventory file. If not
configured, use anta inventory file
--confirm-overwrite Confirm script can overwrite existing
inventory file [env var:
ANTA_GET_FROM_ANSIBLE_CONFIRM_OVERWRITE]
--no-overwrite Do not overwrite existing inventory file [env
var: ANTA_GET_FROM_ANSIBLE_NO_OVERWRITE]
--help Show this message and exit.
```

The output is an inventory where the name of the container is added as a tag for each host:
Expand All @@ -41,6 +45,11 @@ anta_inventory:
!!! warning
The current implementation only considers devices directly attached to a specific Ansible group and does not support inheritence when using the `--ansible-group` option.

By default, if user does not provide `--output` file, anta will save output to configured anta inventory. If the output file has content, anta will ask user to overwrite. This mechanism can be controlled by triggers in case of CI usage: `--confirm-overwrite` and `--no-overwrite`


### Command output

`host` value is coming from the `ansible_host` key in your inventory while `name` is the name you defined for your host. Below is an ansible inventory example used to generate previous inventory:

```yaml
Expand Down

0 comments on commit b5fa87b

Please sign in to comment.