One of the powerful features Opereto provides is service agents mapping (sam): the ability to map services with particular nodes or agents. This mapping guarantees that specific services will only run on specific and relevant hosts. This way, run-time failures and human mistakes can be prevented, for instance, trying to run a ruby script on a host with no ruby installed or starting a windows service on a Linux machine.


Agent mapping for a given service is a simple specification of a set of relevant agents based on id/name of Agent property constraints. The mapping supports regular expressions. Adding custom properties to any given agent is very easy via user interface or API (see agent's API documentation). Following are few examples:


Service agent mapping illustration: Opereto will automatically select an agent from the matching agents [Agent1, Agent4] to run service X.


Mapping Indicators

A mapping indicator is a built-in mapping notation that tells Opereto how to select agents for a given service execution based on the given mapping properties. There are three types of mapping indicators: select (default), any and all. 
  1. select means that the user running a service must explicitly specify a name of agent or agents from the matching list
  2. any instructs Opereto to automatically choose one agent from the matching agent's list. This option is very useful to maintain a cluster of dedicated execution agent hosts (for instance, servers running automation flows) to manage the load of parallel service executions or for redundancy management. 
  3. all instructs Opereto to execute the given service on ALL matching agents. It is useful for maintenance (e.g. cleaning all log directories in the test servers..) or for creating test loads (e.g. run load client from all available agent load servers). Please note that using "all" as a mapping indicator must be done with care!


Service Agents Mapping Specification


The service developer may specify the mapping in a particular file named service.sam.json added to the service directory. The mapping is a short json specification as demonstrated in the following examples:   


Example 1: explicitly select an agent from all agents with a name that starts with "agent" followed by a number (agent1, agent2..) 

{
    "name" : "agent\\d+*"
}

  

Example 2: explicitly select an agent from all agents with a property "tomcat" and a property "role"=="web" or property "role"=="api"  

{
    "tomcat" : true,
    "role" : "web|api"
    
}

   

Example 3: run all agents with a property "tomcat" and a property "role"=="web"  

{
    "tomcat" : true,
    "role" : "web"
}