Hello ansible group,
I would like to ask you for some advices related with dynamic inventories and variables.
I read Dynamic Inventories documentation from asnbile however still don’t see clear picture about solution.
So far ansible-tower is also not solution which I can focus on.
So quick ‘my issue’ which looks like ‘chicken and egg’ problem
- I would like to use ansible to provision servers.
- I would like to use ansible to do some small changes on servers (for example add / remote some account etc - depends of dynamic work)
- I would like to have records about facts (inlcuding local facts) wich can be used for playbooks.
- I would like to have easy way of reasigning host and different tasks will be run.
The way which I see, is that:
- First initial run of ansible - gathers facts and setup some local facts based on varialbe (role / product / environment (test / dev / etc))
(Know already how to use callback functions and record results to DB). - Next runs, reads DB (Dynamic Inventory) and setup servers, updating local facts as well.
- I can change some ‘flag’ in Dynamic Inventory and ansible will run different tasks.
Expected solution is that:
- I can quickly see on which status is server, for example:
- ENV: Development - web servers - completed,
- ENV: Testing - ready for application deplyement.
- Prodcution ---- configuration XXX.
- When I am going to a server I can quickly see in local facts forder what has been done (ini or js file) in terms of configuraiton.
My issue is now that we have a lot of INI inventories files and we maintaning quite a lot of servers (250+).
Adding new servers in ini file depends of product line, and is a bit of slow, this is why I whould like to have start using dynamic invenotry.
However I am not quite sure how to deal with all these variables which we are using.
I like to assigning server to some group, then I can use it in tempaltes, etc. And use variables only for some configuration specific details.
So I would like to ask you in general:
How are you working with ansible day by day when you have to:
- manage big number of hosts where configuration is different (not only web server / DB server - but also web servers have different configuration [apache, nginx])
- see what has been already done via ansible on server (wihtout reading YAML files over and over).
- Dealing with small tasks to adjust configuration on server (for example php variables must be adjusted, or apache max_clients have to be decrased, etc).
- Quickly add / modify server roles and anothers tasks are running.
Maybe my thinking is too big / too complacated - any replies are welcome.
Best regards,
Marcin