Pxelinux.cfg file not created when using discovery plugin API

I'm running into an issue where the pxelinux.cfg file is not created when
using discovery plugin API to provision discovered hosts. Foreman returns a
200 response and the node shows up in the inventory but after rebooting it
does not boot into the installer because of the missing pxelinux.cfg file.
I'm running foreman_discovery-8.0.1 with Foreman 1.14.3. My log output is
below. Any ideas on how to resolve the issue?

/var/log/foreman/production.log

2017-05-15T20:42:47 d83643db [app] [I] Processing by
Api::V2::DiscoveredHostsController#update as JSON
2017-05-15T20:42:47 d83643db [app] [I] Parameters:
{"discovered_host"=>{"ip"=>"44.128.25.4", "mac"=>"00:6b:f1:61:c2:d2",
"name"=>"baremetal.example.com", "hostgroup_id"=>"18"}, "apiv"=>"v2",
"id"=>"277"}
2017-05-15T20:42:47 d83643db [app] [I] Authorized user admin(Admin User)
2017-05-15T20:42:48 d83643db [app] [I] Rendered
vendor/ruby/2.3.0/gems/foreman_discovery-8.0.1/app/views/api/v2/discovered_hosts/update.json.rabl
(1.0ms)
2017-05-15T20:42:48 d83643db [app] [I] Completed 200 OK in 1323ms (Views:
1.8ms | ActiveRecord: 50.9ms)

/var/log/foreman-proxy/proxy.log

I, [2017-05-15T20:42:48.339478 ] INFO – : 44.128.12.21 - -
[15/May/2017:20:42:48 -0600] "PUT /discovery/44.128.25.4/power/reboot
HTTP/1.1" 200 15 0.0948
I, [2017-05-15T20:42:49.239788 ] INFO – : 44.128.12.21 - -
[15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 0.0005
I, [2017-05-15T20:42:49.574627 ] INFO – : 44.128.12.21 - -
[15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 0.0005
E, [2017-05-15T20:42:50.304281 ] ERROR – : Failed to authenticate node .
Missing some headers

I'm using Ansible for the API call. Playbook below.

··· ---
  • hosts: localhost
    tasks:

    • name: Provision Bare Metal Server
      uri:
      url: https://foreman/api/v2/discovered_hosts/278
      user: "user"
      password: "pass"
      body_format: json
      method: PUT
      status_code: 200
      validate_certs: no
      force_basic_auth: yes
      headers:
      Content-Type: "application/json"
      body:
      discovered_host:
      name: "baremetal.example.com"
      hostgroup_id: "18"
      build: "1"
      mac: "00:6b:f1:61:c2:d2"
      ip: “44.128.25.4”

Thanks!

Sean

Hello, might be also Bug #19313: Auto-provisioning does not orchestrate TFTP - Discovery - Foreman

Try to comment out this line:

LZ

··· On Tue, May 16, 2017 at 5:17 AM, Sean Larimore wrote: > I'm running into an issue where the pxelinux.cfg file is not created when > using discovery plugin API to provision discovered hosts. Foreman returns a > 200 response and the node shows up in the inventory but after rebooting it > does not boot into the installer because of the missing pxelinux.cfg file. > I'm running foreman_discovery-8.0.1 with Foreman 1.14.3. My log output is > below. Any ideas on how to resolve the issue? > > > > > > /var/log/foreman/production.log > > 2017-05-15T20:42:47 d83643db [app] [I] Processing by > Api::V2::DiscoveredHostsController#update as JSON > 2017-05-15T20:42:47 d83643db [app] [I] Parameters: > {"discovered_host"=>{"ip"=>"44.128.25.4", "mac"=>"00:6b:f1:61:c2:d2", > "name"=>"baremetal.example.com", "hostgroup_id"=>"18"}, "apiv"=>"v2", > "id"=>"277"} > 2017-05-15T20:42:47 d83643db [app] [I] Authorized user admin(Admin User) > 2017-05-15T20:42:48 d83643db [app] [I] Rendered > vendor/ruby/2.3.0/gems/foreman_discovery-8.0.1/app/views/api/v2/discovered_hosts/update.json.rabl > (1.0ms) > 2017-05-15T20:42:48 d83643db [app] [I] Completed 200 OK in 1323ms (Views: > 1.8ms | ActiveRecord: 50.9ms) > > > /var/log/foreman-proxy/proxy.log > > I, [2017-05-15T20:42:48.339478 ] INFO -- : 44.128.12.21 - - > [15/May/2017:20:42:48 -0600] "PUT /discovery/44.128.25.4/power/reboot > HTTP/1.1" 200 15 0.0948 > I, [2017-05-15T20:42:49.239788 ] INFO -- : 44.128.12.21 - - > [15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 0.0005 > I, [2017-05-15T20:42:49.574627 ] INFO -- : 44.128.12.21 - - > [15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 0.0005 > E, [2017-05-15T20:42:50.304281 ] ERROR -- : Failed to authenticate node . > Missing some headers > > I'm using Ansible for the API call. Playbook below. > > --- > > - hosts: localhost > tasks: > > - name: Provision Bare Metal Server > uri: > url: https://foreman/api/v2/discovered_hosts/278 > user: "user" > password: "pass" > body_format: json > method: PUT > status_code: 200 > validate_certs: no > force_basic_auth: yes > headers: > Content-Type: "application/json" > body: > discovered_host: > name: "baremetal.example.com" > hostgroup_id: "18" > build: "1" > mac: "00:6b:f1:61:c2:d2" > ip: "44.128.25.4" > > > Thanks! > > Sean > > -- > You received this message because you are subscribed to the Google Groups > "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.


Later,
Lukas @lzap Zapletal

I had a similar issue. Removal of line 8 host.clear_association_cache in
app/services/foreman_discovery/host_converter.rb
<https://github.com/theforeman/foreman_discovery/pull/346/files#diff-d165f1f7d8058930cfef75cad203b33e> appears
to have fixed it! Thank you

··· On Wednesday, May 17, 2017 at 2:52:08 AM UTC-6, Lukas Zapletal wrote: > > Hello, might be also http://projects.theforeman.org/issues/19313 > > Try to comment out this line: > > > https://github.com/theforeman/foreman_discovery/pull/346/files#diff-d165f1f7d8058930cfef75cad203b33eR8 > > LZ > > On Tue, May 16, 2017 at 5:17 AM, Sean Larimore > wrote: > > I'm running into an issue where the pxelinux.cfg file is not created > when > > using discovery plugin API to provision discovered hosts. Foreman > returns a > > 200 response and the node shows up in the inventory but after rebooting > it > > does not boot into the installer because of the missing pxelinux.cfg > file. > > I'm running foreman_discovery-8.0.1 with Foreman 1.14.3. My log output > is > > below. Any ideas on how to resolve the issue? > > > > > > > > > > > > /var/log/foreman/production.log > > > > 2017-05-15T20:42:47 d83643db [app] [I] Processing by > > Api::V2::DiscoveredHostsController#update as JSON > > 2017-05-15T20:42:47 d83643db [app] [I] Parameters: > > {"discovered_host"=>{"ip"=>"44.128.25.4", "mac"=>"00:6b:f1:61:c2:d2", > > "name"=>"baremetal.example.com", "hostgroup_id"=>"18"}, "apiv"=>"v2", > > "id"=>"277"} > > 2017-05-15T20:42:47 d83643db [app] [I] Authorized user admin(Admin User) > > 2017-05-15T20:42:48 d83643db [app] [I] Rendered > > > vendor/ruby/2.3.0/gems/foreman_discovery-8.0.1/app/views/api/v2/discovered_hosts/update.json.rabl > > > (1.0ms) > > 2017-05-15T20:42:48 d83643db [app] [I] Completed 200 OK in 1323ms > (Views: > > 1.8ms | ActiveRecord: 50.9ms) > > > > > > /var/log/foreman-proxy/proxy.log > > > > I, [2017-05-15T20:42:48.339478 ] INFO -- : 44.128.12.21 - - > > [15/May/2017:20:42:48 -0600] "PUT /discovery/44.128.25.4/power/reboot > > HTTP/1.1" 200 15 0.0948 > > I, [2017-05-15T20:42:49.239788 ] INFO -- : 44.128.12.21 - - > > [15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 > 0.0005 > > I, [2017-05-15T20:42:49.574627 ] INFO -- : 44.128.12.21 - - > > [15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 > 0.0005 > > E, [2017-05-15T20:42:50.304281 ] ERROR -- : Failed to authenticate node > . > > Missing some headers > > > > I'm using Ansible for the API call. Playbook below. > > > > --- > > > > - hosts: localhost > > tasks: > > > > - name: Provision Bare Metal Server > > uri: > > url: https://foreman/api/v2/discovered_hosts/278 > > user: "user" > > password: "pass" > > body_format: json > > method: PUT > > status_code: 200 > > validate_certs: no > > force_basic_auth: yes > > headers: > > Content-Type: "application/json" > > body: > > discovered_host: > > name: "baremetal.example.com" > > hostgroup_id: "18" > > build: "1" > > mac: "00:6b:f1:61:c2:d2" > > ip: "44.128.25.4" > > > > > > Thanks! > > > > Sean > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Foreman users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to foreman-user...@googlegroups.com . > > To post to this group, send email to forema...@googlegroups.com > . > > Visit this group at https://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > > > > -- > Later, > Lukas @lzap Zapletal >

Oh if this is the one, then this will be fixed in the upcoming
Discovery 9.1. We are almost there, expect it this week!

LZ

··· On Fri, Jun 2, 2017 at 10:22 PM, wrote: > I had a similar issue. Removal of line 8 host.clear_association_cache in > app/services/foreman_discovery/host_converter.rb appears to have fixed it! > Thank you > > On Wednesday, May 17, 2017 at 2:52:08 AM UTC-6, Lukas Zapletal wrote: >> >> Hello, might be also http://projects.theforeman.org/issues/19313 >> >> Try to comment out this line: >> >> >> https://github.com/theforeman/foreman_discovery/pull/346/files#diff-d165f1f7d8058930cfef75cad203b33eR8 >> >> LZ >> >> On Tue, May 16, 2017 at 5:17 AM, Sean Larimore wrote: >> > I'm running into an issue where the pxelinux.cfg file is not created >> > when >> > using discovery plugin API to provision discovered hosts. Foreman >> > returns a >> > 200 response and the node shows up in the inventory but after rebooting >> > it >> > does not boot into the installer because of the missing pxelinux.cfg >> > file. >> > I'm running foreman_discovery-8.0.1 with Foreman 1.14.3. My log output >> > is >> > below. Any ideas on how to resolve the issue? >> > >> > >> > >> > >> > >> > /var/log/foreman/production.log >> > >> > 2017-05-15T20:42:47 d83643db [app] [I] Processing by >> > Api::V2::DiscoveredHostsController#update as JSON >> > 2017-05-15T20:42:47 d83643db [app] [I] Parameters: >> > {"discovered_host"=>{"ip"=>"44.128.25.4", "mac"=>"00:6b:f1:61:c2:d2", >> > "name"=>"baremetal.example.com", "hostgroup_id"=>"18"}, "apiv"=>"v2", >> > "id"=>"277"} >> > 2017-05-15T20:42:47 d83643db [app] [I] Authorized user admin(Admin User) >> > 2017-05-15T20:42:48 d83643db [app] [I] Rendered >> > >> > vendor/ruby/2.3.0/gems/foreman_discovery-8.0.1/app/views/api/v2/discovered_hosts/update.json.rabl >> > (1.0ms) >> > 2017-05-15T20:42:48 d83643db [app] [I] Completed 200 OK in 1323ms >> > (Views: >> > 1.8ms | ActiveRecord: 50.9ms) >> > >> > >> > /var/log/foreman-proxy/proxy.log >> > >> > I, [2017-05-15T20:42:48.339478 ] INFO -- : 44.128.12.21 - - >> > [15/May/2017:20:42:48 -0600] "PUT /discovery/44.128.25.4/power/reboot >> > HTTP/1.1" 200 15 0.0948 >> > I, [2017-05-15T20:42:49.239788 ] INFO -- : 44.128.12.21 - - >> > [15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 >> > 0.0005 >> > I, [2017-05-15T20:42:49.574627 ] INFO -- : 44.128.12.21 - - >> > [15/May/2017:20:42:49 -0600] "GET /tftp/serverName HTTP/1.1" 200 17 >> > 0.0005 >> > E, [2017-05-15T20:42:50.304281 ] ERROR -- : Failed to authenticate node >> > . >> > Missing some headers >> > >> > I'm using Ansible for the API call. Playbook below. >> > >> > --- >> > >> > - hosts: localhost >> > tasks: >> > >> > - name: Provision Bare Metal Server >> > uri: >> > url: https://foreman/api/v2/discovered_hosts/278 >> > user: "user" >> > password: "pass" >> > body_format: json >> > method: PUT >> > status_code: 200 >> > validate_certs: no >> > force_basic_auth: yes >> > headers: >> > Content-Type: "application/json" >> > body: >> > discovered_host: >> > name: "baremetal.example.com" >> > hostgroup_id: "18" >> > build: "1" >> > mac: "00:6b:f1:61:c2:d2" >> > ip: "44.128.25.4" >> > >> > >> > Thanks! >> > >> > Sean >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Foreman users" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to foreman-user...@googlegroups.com. >> > To post to this group, send email to forema...@googlegroups.com. >> > Visit this group at https://groups.google.com/group/foreman-users. >> > For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> Later, >> Lukas @lzap Zapletal


Later,
Lukas @lzap Zapletal