From 0ad65591591c735097c0d75ad1218d34da1a47cc Mon Sep 17 00:00:00 2001 From: Carolina Fernandez <carolina.fernandez@i2cat.net> Date: Wed, 24 Jan 2024 12:28:28 +0100 Subject: [PATCH] feature/doc-update: add more details in README --- README.md | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8437d31..14879d3 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,49 @@ -Ansible Inventory Generator -Overview +# Ansible Inventory Generator -This project aims to automate the generation of Ansible inventory files by pulling data from the WFO API. +## Overview -Features +Tool for the automated generation of Ansible inventory files by pulling data extracted from the WFO API. - Generate Ansible inventory from WFO API. - Save processed data to appropriate inventory file(s). - Ensure no alteration to existing inventory files in case of process failure. +## Features -Once installed, you can use the `ansible_inventory_generator` command to generate the Ansible inventory from the API: +* Generate Ansible inventory from WFO API. +* Save processed data to appropriate inventory file(s). +* Ensure no alteration to existing inventory files in case of process failure. + +## Installation + +Install from PIP. ```bash pip install \ --pre \ --extra-index-url https://artifactory.software.geant.org/artifactory/api/pypi/geant-swd-pypi/simple \ ansible-inventory-generator - +``` + +## Deployment + +Fill in environment variables and run the command to generate the Ansible inventory from the API. + +```bash +# Rewritting environment variables +## URL of the WFO API (change IP only) export api_url=http://127.0.0.1:8080/api/v1/subscriptions/routers +## Full paths where this tool will save variables and inventory files export host_vars_dir=/path/to/base/hostvars/dir -export vars_file_name=wfo_vars.yaml export hosts_file_dir=/path/to/base/hosts/dir +## Full path where this tool will save the WFO variables +export vars_file_name=wfo_vars.yaml + +# Execution of the command to generate the Ansible inventory files +ansible_inventory_generator +``` + +Ansible inventory files will be available under the path stated under `hosts_file_dir`. + +## Troubleshooting + +### 403 error -ansible_inventory_generator \ No newline at end of file +This tol cannot reach the WFO API because it is authenticated. +Correct it by redeploying WFO by first running `export OAUTH2_ACTIVE=false` and then re-running WFO. -- GitLab