Utilising smart proxy farmout and logs

Problem:
When you invoc a job on foreman server it able to farm that job out to the proxy server. It is possible to invoke this function in say a shell or ansible script. to utilise the host names connection and whatever tunelling is going on. I dont have the estate in DNS and there are duplicate subnets across different locations firewalld off.
I found the ansible foreman pakage which allows to invoke jobs but I was looking for a way to use that capability without using the foreman job scheduler.
LOGGING:
I have quite a large estate and the logging on foreman makes it impossible to use. is there a way to run a job against lots of hosts and get the log into one file ?
At the moment I pull it using a loop against every hostname using hammer job-invocation show but it takes forever.

Expected outcome:

Foreman and Proxy versions:
foreman-2.3.5
katello-3.18.3
Pulp 3 and 2 on proxy’s
Foreman and Proxy plugin versions:
foreman-tasks 3.0.6
foreman_ansible 6.1.1
foreman_discovery 16.3.4
foreman_remote_execution 4.2.2
katello 3.18.3.1
Distribution and version:

Other relevant data:

Hi,
I’m not quite sure I follow the first part. You cannot really run a job from foreman without using its job scheduler. However, it should be possible to use Foreman as an inventory for ansible itself if that’s what you’re after.

With the versions you have there is no other way to get outputs for all hosts in a job with a single hammer command/api call so you need to pull it using a loop outside of Foreman.
An api for retrieving all outputs of all hosts in a single job (/api/v2/job_invocations/$job_id/outputs) was added in foreman-remote-execution-4.3.0.

Hi, yeah basically I’d like to use foreman as an ansible inventory.

In that case this theforeman.foreman.foreman – Foreman inventory source — Ansible Documentation might be of interest to you