Project

General

Profile

External Nodes » History » Revision 14

Revision 13 (Marcello de Sousa, 01/03/2011 04:35 PM) → Revision 14/30 (keith obrien, 04/28/2011 01:02 PM)

h1. Foreman can act as a classifier to Puppet through the external nodes interface. 

 You can now configure your hosts via a web interface, avoiding typing host specific information in your manifest. 

 {{toc}} 

 h2. Import your environment and classes setup 

 First of all, you probably want to let Foreman know about your setup, if you are using puppet modules - Foreman can import your setup automatically (environments and classes) by: 

 <pre> 
 rake puppet:import:puppet_classes RAILS_ENV=production 
 </pre> 

 If you get a prompt you might avoid it with the batch mode using: 
 <pre> 
 rake puppet:import:puppet_classes[batch] RAILS_ENV=production 
 </pre> 


 If you prefer, you may manually add classes through the setting page, however, the class names must match Puppet classes. 

 if for from some reason you can't see your nodes, please make sure that you have the following line in your puppet.conf file (or similar) 
 <pre>modulepath=/etc/puppet/modules</pre>  

 h2. Define classes and variables per host 

 You can define per host, classes and variables(parameters), simply create/edit a host, and select its classes. 
 if you see an empty list, make sure that you do have classes (as define in the step above). 

 If you want to add variables(parameters), simply add them in the same page as a set name and value. 

 h2. Host Groups 

 Foreman allows you to group classes, into common groups similar to node inheritances in puppet  
 Each group can contain many classes, and variables. 

 If you wish to override the parameters for a specific host, create a parameter with the same name in the host level,  
 Foreman will override the values defined in the group level. 


 h2. Other places you can define parameters 

 It is also possible to define default (common) parameters for all of your hosts (setting -> Global parameters). 
 Additionally, you can also define them on the domain level (settings -> Domain -> Domain Parameters) 

 *The order in which the parameters are processed is: 
 Global, Domain, Host Group and Node, the last occurrence of the parameter will be the one used. 
 * 

 h2. Example puppet external nodes script 

 You may find an example script under *extras/puppet/foreman/files/external_node.rb*  

 You would need to setup puppet to use external nodes  
 <pre>    external_nodes = /etc/puppet/node.rb 
   node_terminus    = exec</pre> 
 For additional info please see "Puppet documentation":http://reductivelabs.com/trac/puppet/wiki/ExternalNodes 

 h2. Verify your setup 

 You may also click on the YAML link to see the output that would be used for puppet external nodes. 

 h2. Import your external node setup from an older external node setup 

 If you already had an external node setup, you can import your old setup directly to Foreman 

 *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. 
 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. 

 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). 

 To import the classes and parameters per host, run: 

 <pre> 
 rake puppet:import:external_nodes script=/path/to/old_external_node_script RAILS_ENV=production 
 </pre> 


 *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.