Project

General

Profile

External Nodes » History » Version 10

Ohad Levy, 11/24/2009 06:31 AM

1 3 Ohad Levy
h1. Foreman can act as a classifier to Puppet through the external nodes interface.
2 1 Ohad Levy
3 10 Ohad Levy
You can now configure your hosts via a web interface, avoiding typing host specific information in your manifest.
4
5 4 Ohad Levy
{{toc}}
6
7 2 Ohad Levy
h2. Import your environment and classes setup
8 1 Ohad Levy
9 3 Ohad Levy
First of all, you probably want to let Foreman know about your setup, its recommended to automatically import your Environments and classes by:
10 1 Ohad Levy
11
<pre>
12
rake puppet:import:puppet_classes RAILS_ENV=production
13
</pre>
14
15
If you prefer, you may manually add classes through the setting page, however, the class names must match Puppet classes.
16
17
18 2 Ohad Levy
h2. Define classes and variables per host
19 1 Ohad Levy
20
You can define per host, classes and variables(parameters), simply create/edit a host, and select its classes.
21
if you see an empty list, make sure that you do have classes (as define in the step above).
22
23
If you want to add variables(parameters), simply add them in the same page as a set name and value.
24
25 2 Ohad Levy
h2. Host Groups
26 1 Ohad Levy
27 3 Ohad Levy
Foreman allows you to group classes, into common groups similar to node inheritances in puppet 
28 1 Ohad Levy
Each group can contain many classes, and variables.
29
30
If you wish to override the parameters for a specific host, create a parameter with the same name in the host level, 
31 3 Ohad Levy
Foreman will override the values defined in the group level.
32 1 Ohad Levy
33
34 2 Ohad Levy
h2. Other places you can define parameters
35 1 Ohad Levy
36 5 Ohad Levy
It is also possible to define default (common) parameters for all of your hosts (setting -> Global parameters).
37 1 Ohad Levy
Additionally, you can also define them on the domain level (settings -> Domain -> Domain Parameters)
38
39
*The order in which the parameters are processed is:
40
Global, Domain, Host Group and Node, the last occurrence of the parameter will be the one used.
41
*
42
43 9 Ohad Levy
h2. Example puppet external nodes script
44 1 Ohad Levy
45 9 Ohad Levy
You may find an example script under *extras/puppet/foreman/files/external_node.rb* 
46 1 Ohad Levy
47
You would need to setup puppet to use external nodes 
48
<pre>  external_nodes = /etc/puppet/node.rb
49
  node_terminus  = exec</pre>
50
For additional info please see "Puppet documentation":http://reductivelabs.com/trac/puppet/wiki/ExternalNodes
51
52
h2. Verify your setup
53
54
You may also click on the YAML link to see the output that would be used for puppet external nodes.
55 8 Ohad Levy
56
h2. Import your external node setup from an older external node setup
57
58
If you already had an external node setup, you can import your old setup directly to Foreman
59
60
*Note*: This will import your classes and variables (parameters or tags) directly, that means that if you have any logic to dynamically generate the variables, it would not be imported.
61
However, if you define your parameters in the domain level (for example) they will not be added to every single host, therefor, if you want to apply certain parameters per domain, host class etc, you should define them prior to running the importer.
62
63
additionally, it will not import any invalid settings, e.g. parameters which has the same name as facts, or a non string parameters (some classifiers tend to create those).
64
65
To import the classes and parameters per host, run:
66
67
<pre>
68
rake puppet:import:external_nodes script=/path/to/old_external_node_script RAILS_ENV=production
69
</pre>
70
71
72
*Note*: This will only scan for hosts that already exists in our database, if you want to import hosts, use one of the other importers.