Feature #13812
closedRemote execution provider
Description
Ansible can be used as a provider for remote execution. The job templates can be Ansible playbooks that use host parameters, properties and ERB.
Job templates, however, should have a 'hosts' section that just contains <%= @host.name %>, because a new inventory is generated per host with all the required variables.
In any case, the way it should work is:
Foreman sends request to proxy - including the 'hosts' it's supposed to run on.
Proxy generates an inventory with the hosts and variables required
Proxy runs ansible and reports to Foreman
The reason why ansible_foreman_inventory cannot be used in this case is because it's less flexible than the 'search' field of REX, where one can use the 'scoped_search' syntax to figure out what hosts to run the playbook on. If we used ansible_foreman_inventory for that, we would be forced to run our playbooks on a set of hosts, hostgroups, organiztions or locations.