Json-fact-format » History » Version 6
Marek Hulán, 12/17/2013 01:37 PM
1 | 1 | Romain Vrignaud | h1. Json-fact-format |
---|---|---|---|
2 | |||
3 | h3. how to send facts |
||
4 | |||
5 | * Foreman reports need to be sent to /api/hosts/facts |
||
6 | 3 | Marek Hulán | * Following headers needs to be present: |
7 | 1 | Romain Vrignaud | <pre> |
8 | "Accept: application/json,version=2" |
||
9 | "Content-Type: application/json" |
||
10 | </pre> |
||
11 | |||
12 | h3. facts JSON format |
||
13 | |||
14 | <pre> |
||
15 | { |
||
16 | 5 | Greg Sutcliffe | "name" => "fqdn.example.com", |
17 | "certname" => "optional.certname.for.this.host", |
||
18 | "facts" => { |
||
19 | "fact1" => "value", |
||
20 | "fact2" => "value", |
||
21 | 6 | Marek Hulán | "fact2::nested:fact" => "value", |
22 | 5 | Greg Sutcliffe | "_timestamp" => "2013-10-18 07:47:45 +0000", |
23 | 6 | Marek Hulán | "_type" => "puppet" |
24 | 5 | Greg Sutcliffe | "operatingsystem" => 'Debian', |
25 | "operatingsystemrelease" => '7.0' |
||
26 | } |
||
27 | 1 | Romain Vrignaud | } |
28 | 4 | Marek Hulán | </pre> |
29 | 1 | Romain Vrignaud | |
30 | 6 | Marek Hulán | Note that _timestamp, operatingsystem and operatingsystemrelease are mandatory. Certname is optional, but if provided it will be preferred over name to identify the host object in the db. _type identifies source of fact, currently only puppet is supported by Foreman core and is also a default value if unspecified. If you want to add another fact type, you can register your importer class in FactImporter.register_fact_importer. For more info and example see https://github.com/ares/foreman_chef |