Deploy on fly

Problem:
Hello everyone.
The first problem is that I couldn’t find a description of handle discovered_host which is supposed to make an auto-provisioning.

Expected outcome:
My goal is to integrate an internal system with foreman. I would like to setup OS to my bare metal servers and I want to do it on a fly using API without preparing hostgroups, domains and subnets.

So deployment should look like a have prepared just templates, other information passes from our internal system like hostname operation system, arch, disk count and so on.
So I would like to know what exactly fields are required to pass and is it possible what I’m talking about.

Foreman and Proxy versions:
Installed Packages
foreman.noarch 1.14.3-1.el7 @foreman

Installed Packages
foreman-proxy.noarch 1.14.3-1.el7 @foreman

Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]

Hello, auto provisioning requires hostgroups to be set. You can however create a API/CLI script that will list all discovered hosts and then initiate provisioning where you can pass all arguments manually:

hammer discovery list

Lists all hosts.

hammer discovery provision --help
Usage:
    hammer discovery provision [OPTIONS]

Options:
 --architecture ARCHITECTURE_NAME                        Architecture name
 --architecture-id ARCHITECTURE_ID                        
 --ask-root-password ASK_ROOT_PW                         One of true/false, yes/no, 1/0.
 --build BUILD                                           One of true/false, yes/no, 1/0.
 --capabilities CAPABILITIES                              
 --domain DOMAIN_NAME                                    Domain name
 --domain-id DOMAIN_ID                                   Numerical ID or domain name
 --enabled ENABLED                                       One of true/false, yes/no, 1/0.
 --environment ENVIRONMENT_NAME                          Environment name
 --environment-id ENVIRONMENT_ID                          
 --host-parameters-attributes HOST_PARAMETERS_ATTRIBUTES Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --hostgroup HOSTGROUP_NAME                              Hostgroup name
 --hostgroup-id HOSTGROUP_ID                              
 --hostgroup-title HOSTGROUP_TITLE                       Hostgroup title
 --id ID                                                  
 --image IMAGE_NAME                                      Name to search by
 --image-id IMAGE_ID                                      
 --interface INTERFACE                                   Interface parameters
                                                         Comma-separated list of key=value
                                                         Can be specified multiple times.
 --ip IP                                                 Not required if using a subnet with DHCP proxy
 --location LOCATION_NAME                                Location name
 --location-id LOCATION_ID                                
 --location-title LOCATION_TITLE                         Location title
 --mac MAC                                               Not required if it’s a virtual machine
 --managed MANAGED                                       One of true/false, yes/no, 1/0.
 --medium MEDIUM_NAME                                    Medium name
 --medium-id MEDIUM_ID                                    
 --model MODEL_NAME                                      Model name
 --model-id MODEL_ID                                      
 --name NAME                                             Name to search by
 --new-name NEW_NAME                                      
 --operatingsystem OPERATINGSYSTEM_TITLE                 Operating system title
 --operatingsystem-id OPERATINGSYSTEM_ID                  
 --organization ORGANIZATION_NAME                        Organization name
 --organization-id ORGANIZATION_ID                        
 --organization-title ORGANIZATION_TITLE                 Organization title
 --overwrite OVERWRITE                                   One of true/false, yes/no, 1/0.
 --owner-id OWNER_ID                                      
 --parameters PARAMS                                     Host parameters
                                                         Comma-separated list of key=value
 --partition-table PARTITION_TABLE_NAME                  Partition table name
 --partition-table-id PARTITION_TABLE_ID                  
 --progress-report-id PROGRESS_REPORT_ID                 UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks
 --provision-method METHOD                               Possible value(s): 'build', 'image'
 --puppet-ca-proxy-id PUPPET_CA_PROXY_ID                  
 --puppet-proxy-id PUPPET_PROXY_ID                        
 --puppetclass-ids PUPPETCLASS_IDS                       Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --pxe-loader PXE_LOADER                                 DHCP filename option (Grub2 or PXELinux by default)
                                                         Possible value(s): 'None', 'PXELinux BIOS', 'PXELinux UEFI', 'Grub UEFI', 'Grub2 UEFI', 'Grub2 UEFI SecureBoot', 'Grub2 UEFI HTTP', 'Grub2 UEFI HTTPS', 'Grub2 UEFI HTTPS SecureBoot', 'iPXE Embedded', 'iPXE UEFI HTTP', 'iPXE Chain BIOS', 'iPXE Chain UEFI'
 --root-password ROOT_PW                                  
 --sp-subnet-id SP_SUBNET_ID                              
 --subnet SUBNET_NAME                                    Subnet name
 --subnet-id SUBNET_ID                                    
 -h, --help                                              Print help

There you go if you want to pass everything in. If you have some plugins installed, more options might be required.