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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to