-
Notifications
You must be signed in to change notification settings - Fork 7
Metatargets, Dependencies and Readonly Services
This section describes the use of metatargets and readonly services.
The term Metatargets refers to the inclusion of targets from within other targets. Under certain circumstances, for example when creating constructs from many interdependent target files, you may end up not specifying all the dependencies of a service or host in your target files. In this case any services that can not be resolved within the current target automatically become Readonly Services.
Readonly services are special, because they can not be controlled -- in the sense of a state change -- from YADT. Instead you may only query and display their current status.
Consider the following directory structure:
.
├── all
│ └── target
├── appserver
│ └── target
└── webserver
└── target
The file webserver/target
initially looks like:
hosts:
webserver.example.com
And the webserver
machine contains the following configuration:
services:
httpd:
is_frontservice: true
needs_services: ["service://appserver.example.com/tomcat"]
In this case the tomcat service is located on the remote machine appserver
and since the target file contains only the host webserver
the tomcat
service is now readonly.
Next, let's have a look at the appserver
target file, that contains the missing host:
hosts:
appserver.example.com
You can then use the metatargets feature to include both targets from the target file in the all/target
:
includes:
- webserver
- appserver
In this case, the tomcat
service will not be readonly, since the target includes both the webserver
and the appserver
and so also the tomcat
service that the httpd
service depends on.