From b5fa87b47a414104564c0921ed47097fec2498f7 Mon Sep 17 00:00:00 2001 From: Thomas Grimonet Date: Mon, 20 Nov 2023 12:39:25 +0100 Subject: [PATCH] doc: Update doc accordingly --- docs/cli/inv-from-ansible.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/cli/inv-from-ansible.md b/docs/cli/inv-from-ansible.md index baa01e7e2..fc7bf332c 100644 --- a/docs/cli/inv-from-ansible.md +++ b/docs/cli/inv-from-ansible.md @@ -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: @@ -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