A unified plaintext store of all fsfe hosts that are managed with Ansible. Supposed to be integrated into the relevant repos as a git submodule.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Max Mehl 6686dd098e
unify REUSE API server classes
1 day ago
.gitignore Initial commit 2 weeks ago
LICENSE Initial commit 2 weeks ago
README.md changed README.md 1 week ago
create-inventory.sh changed dir structure to match ansible defaults in submodule 1 week ago
hosts unify REUSE API server classes 1 day ago
inventory.txt unify REUSE API server classes 1 day ago

README.md

Ansible Inventory

A unified plaintext store (inventory.txt) of all of our hosts that are managed with Ansible. Supposed to be integrated into the relevant Ansible repos as a git submodule.

How it works

It is simple. The bash script create-inventory.sh reads the lines from inventory.txt and constructs a well-defined Ansible inventory file for all our hosts from it. This is handy because it allows for a more streamlined adding, removing and changing of hosts and the groups that they are in.

Adding a host

inventory.txt has the following structure. To add a new host, simply add a new line starting with - followed by a space, then the hostname and then the applicable groups in square brackets.

To illustrate, create-inventory.sh would take the input below

# some comment
- example.fsfe.org [group1, group2, group3, group4]
- example2.fsfe.org [group1, group5]

and transform it into

[group1]
example.fsfe.org
example2.fsfe.org

[group2]
example.fsfe.org

[group3]
example.fsfe.org

[group4]
example.fsfe.org

[group5]
example2.fsfe.org

Removing or changing a host

The script regenarates the hosts file on each run. So, removing or changing a host is trivial.

Possible future improvements

Resources