I have a “base” directory which installing base things like monitoring, ntp, etc. Which we need almost on all our servers.
Directory “lnmp_standalone” will install Nginx, Php-Fpm, MySql on linux. But it also mean “base” things like monitoring, ntp should be installed. Without copying tasks from “base” directory to “lnmp_standalone” and maintain all versions of copied files, have the ansible a functional of importing role from another dir?
I see “import_role” function will import only from “roles” subdirectory from where you start your playbook. For example if I would be in “lnmp_standalone” dir and run:
ansible-playbook site.yml
It will look for import role only from subdirectory “roles”. Or I am wrong? And there is a way importing from …/…/base/roles?
If import_role cannot look to level up directories how we can avoid repeating myself with again and again writing base things which want to be included on all roles?
I know it. But i feel from one project to another I will want include each time different roles. For example in project configures web server i want include monitoring role from
…/monitoring/roles
In another project i want include roles from
…/base/roles
Maybe i wrong understand. But from my point of view, and how ansible show it in examples:
Each folder configuring separate application. For example: lamp_standalone install apache, and lamp_haproxy also install apache. But it is dublication. Maybe better will have one place where we will have task for install apache and include it appropriate to lampfstandalone and to lamp_haproxy?
We will no need maintain install apache task in several places.