Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible Inventory Generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
Ansible Inventory Generator
Commits
0ad65591
Verified
Commit
0ad65591
authored
1 year ago
by
Carolina Fernandez
Browse files
Options
Downloads
Patches
Plain Diff
feature/doc-update: add more details in README
parent
435a65a9
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2
feature/doc-update: add more details in README
Pipeline
#85489
passed
1 year ago
Stage: tox
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+35
-11
35 additions, 11 deletions
README.md
with
35 additions
and
11 deletions
README.md
+
35
−
11
View file @
0ad65591
Ansible Inventory Generator
# Ansible Inventory Generator
Overview
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.
## Features
Save processed data to appropriate inventory file(s).
Ensure no alteration to existing inventory files in case of process failure.
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
```
bash
pip
install
\
pip
install
\
--pre
\
--pre
\
--extra-index-url
https://artifactory.software.geant.org/artifactory/api/pypi/geant-swd-pypi/simple
\
--extra-index-url
https://artifactory.software.geant.org/artifactory/api/pypi/geant-swd-pypi/simple
\
ansible-inventory-generator
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
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
host_vars_dir
=
/path/to/base/hostvars/dir
export
vars_file_name
=
wfo_vars.yaml
export
hosts_file_dir
=
/path/to/base/hosts/dir
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
This tol cannot reach the WFO API because it is authenticated.
\ No newline at end of file
Correct it by redeploying WFO by first running
`export OAUTH2_ACTIVE=false`
and then re-running WFO.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment