|
1 day ago | |
---|---|---|
.gitignore | 2 weeks ago | |
LICENSE | 2 weeks ago | |
README.md | 1 week ago | |
create-inventory.sh | 1 week ago | |
hosts | 1 day ago | |
inventory.txt | 1 day ago |
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.
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.
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
The script regenarates the hosts
file on each run. So, removing or changing a
host is trivial.