This works fine when you only have 1 task or 1 role, but I currently have 10 roles with multiple configurations, and each role has its own set of tasks, files, templates, etc.
I considered creating separate directories in each role, for each OS, but then handlers, templates and other files will need to be duplicated.
Is there a “package” module to replace “yum/apt” ? If not, can someone recommend a better approach? So far all the solutions I’ve found are only good as “examples”, but far from ideal in the real world.
This is very neat, related to this how do i use varaibles/facts for hosts, i tried the documentation example following in ansible, ansible-playbook but could not get it working
webservers:!{{excluded}}:&{{required}}
where should I define these variables, i tried to define them in the inventory hosts files, or pass them via the “-e” option both did not work for me.
Walid, this question came up the other day and I mentioned that it works correctly when setting the variable with -e. Could you post some samples of your inventory/playbook.
Also, if asking a new question it’s generally best to start a new thread, to avoid confusion and switching topics.
you can use the {{ansible_pkg_manager}} variable to try to make it a single task, but then you have the problem of the package names not matching, so James’ solution is the best option.