mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adds an alternative layout of inventories best practices
This commit is contained in:
parent
f50c0a78b2
commit
6dd07de10b
1 changed files with 41 additions and 0 deletions
|
@ -68,6 +68,47 @@ The top level of the directory would contain files and directories like so::
|
||||||
|
|
||||||
.. note: If you find yourself having too many top level playbooks (for instance you have a playbook you wrote for a specific hotfix, etc), it may make sense to have a playbooks/ directory instead. This can be a good idea as you get larger. If you do this, configure your roles_path in ansible.cfg to find your roles location.
|
.. note: If you find yourself having too many top level playbooks (for instance you have a playbook you wrote for a specific hotfix, etc), it may make sense to have a playbooks/ directory instead. This can be a good idea as you get larger. If you do this, configure your roles_path in ansible.cfg to find your roles location.
|
||||||
|
|
||||||
|
.. _alternative_directory_layout:
|
||||||
|
|
||||||
|
Alternative Directory Layout
|
||||||
|
````````````````
|
||||||
|
|
||||||
|
Alternatively you can put each inventory file with its ``group_vars``/``host_vars`` in a separate directory. This is particularly useful if your ``group_vars``/``host_vars`` don't have that much in common in different environments. The layout could look something like this::
|
||||||
|
|
||||||
|
inventories/
|
||||||
|
production/
|
||||||
|
hosts.ini # inventory file for production servers
|
||||||
|
group_vars/
|
||||||
|
group1 # here we assign variables to particular groups
|
||||||
|
group2 # ""
|
||||||
|
host_vars/
|
||||||
|
hostname1 # if systems need specific variables, put them here
|
||||||
|
hostname2 # ""
|
||||||
|
|
||||||
|
staging/
|
||||||
|
hosts.ini # inventory file for staging environment
|
||||||
|
group_vars/
|
||||||
|
group1 # here we assign variables to particular groups
|
||||||
|
group2 # ""
|
||||||
|
host_vars/
|
||||||
|
stagehost1 # if systems need specific variables, put them here
|
||||||
|
stagehost2 # ""
|
||||||
|
|
||||||
|
library/
|
||||||
|
filter_plugins/
|
||||||
|
|
||||||
|
site.yml
|
||||||
|
webservers.yml
|
||||||
|
dbservers.yml
|
||||||
|
|
||||||
|
roles/
|
||||||
|
common/
|
||||||
|
webtier/
|
||||||
|
monitoring/
|
||||||
|
fooapp/
|
||||||
|
|
||||||
|
This layout gives you more flexibility for larger environments, as well as a total separation of inventory variables between different environments. The downside is that it is harder to maintain, because there are more files.
|
||||||
|
|
||||||
.. _use_dynamic_inventory_with_clouds:
|
.. _use_dynamic_inventory_with_clouds:
|
||||||
|
|
||||||
Use Dynamic Inventory With Clouds
|
Use Dynamic Inventory With Clouds
|
||||||
|
|
Loading…
Reference in a new issue