Hello experts,
after going over the ansible documentation I have found this mix of recommendations a good starting point to setup a brand new structure. Here is the idea:
-
Inventory: I split it into two so that I can decouple prod from staging. Concerning the variables would place here only complete global stuff which is independent from tasks. e.g windwos login creds … ok?
-
site.yml incudes playbooks I have webservers.yml as example for one playbook here, I tend to use for the playbooks the same names as I have in the inventory for the groups of host - is that ok?
-
webservers.yml only defines the groups to act on and “calls” roles.
- name: apply the webserver configuration
hosts: webservers
roles: - javajdk
- …
- the roles should be more or less self standing, so I want to define needed variables “in” the substructur (pls see roles/var)
Questions I have:
- it this approach simple and flexible enough to server lager environments?
- is the location for variable declaration ok
- do the naming pattern fit
.
├── inventories
│ ├── production
│ │ │
│ │ …
│ └── staging
│ ├── group_vars
│ │ └── windows.yml
│ ├── hosts
│ └── host_vars
│ └── hostname1
├── roles
│ └── javajdk
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ │ ├── …
│ │ └── webapps.zip
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── README.md
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── site.yml
└── webservers.yml
All the best and thanks a lot
Michael