External Nodes » History » Version 7
Ohad Levy, 09/18/2009 06:14 AM
| 1 | 3 | Ohad Levy | h1. Foreman can act as a classifier to Puppet through the external nodes interface. |
|---|---|---|---|
| 2 | 1 | Ohad Levy | |
| 3 | 4 | Ohad Levy | {{toc}} |
| 4 | |||
| 5 | 2 | Ohad Levy | h2. Import your environment and classes setup |
| 6 | 1 | Ohad Levy | |
| 7 | 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: |
| 8 | 1 | Ohad Levy | |
| 9 | <pre> |
||
| 10 | rake puppet:import:puppet_classes RAILS_ENV=production |
||
| 11 | </pre> |
||
| 12 | |||
| 13 | If you prefer, you may manually add classes through the setting page, however, the class names must match Puppet classes. |
||
| 14 | |||
| 15 | |||
| 16 | 7 | Ohad Levy | h2. Import your external node setup from an older external node setup |
| 17 | |||
| 18 | If you already had an external node setup, you can import your old setup directly to Foreman |
||
| 19 | |||
| 20 | *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. |
||
| 21 | You might want to consider to define parameters in some other scope - see bellow. |
||
| 22 | |||
| 23 | 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). |
||
| 24 | |||
| 25 | To import the classes and parameters per host, run: |
||
| 26 | |||
| 27 | <pre> |
||
| 28 | rake puppet:import:external_nodes script=/path/to/old_external_node_script RAILS_ENV=production |
||
| 29 | </pre> |
||
| 30 | |||
| 31 | |||
| 32 | *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. |
||
| 33 | |||
| 34 | 2 | Ohad Levy | h2. Define classes and variables per host |
| 35 | 1 | Ohad Levy | |
| 36 | You can define per host, classes and variables(parameters), simply create/edit a host, and select its classes. |
||
| 37 | if you see an empty list, make sure that you do have classes (as define in the step above). |
||
| 38 | |||
| 39 | If you want to add variables(parameters), simply add them in the same page as a set name and value. |
||
| 40 | |||
| 41 | 2 | Ohad Levy | h2. Host Groups |
| 42 | 1 | Ohad Levy | |
| 43 | 3 | Ohad Levy | Foreman allows you to group classes, into common groups similar to node inheritances in puppet |
| 44 | 1 | Ohad Levy | Each group can contain many classes, and variables. |
| 45 | |||
| 46 | If you wish to override the parameters for a specific host, create a parameter with the same name in the host level, |
||
| 47 | 3 | Ohad Levy | Foreman will override the values defined in the group level. |
| 48 | 1 | Ohad Levy | |
| 49 | |||
| 50 | 2 | Ohad Levy | h2. Other places you can define parameters |
| 51 | 1 | Ohad Levy | |
| 52 | 5 | Ohad Levy | It is also possible to define default (common) parameters for all of your hosts (setting -> Global parameters). |
| 53 | 1 | Ohad Levy | Additionally, you can also define them on the domain level (settings -> Domain -> Domain Parameters) |
| 54 | |||
| 55 | 5 | Ohad Levy | *The order in which the parameters are processed is: |
| 56 | 1 | Ohad Levy | Global, Domain, Host Group and Node, the last occurrence of the parameter will be the one used. |
| 57 | * |
||
| 58 | |||
| 59 | 2 | Ohad Levy | h2. Example puppet script |
| 60 | 1 | Ohad Levy | |
| 61 | 6 | Ohad Levy | under the *extras/externalnodes* directory you would find an example script to query Foreman DB. |
| 62 | 1 | Ohad Levy | |
| 63 | You would need to setup puppet to use external nodes |
||
| 64 | <pre> external_nodes = /etc/puppet/node.rb |
||
| 65 | node_terminus = exec</pre> |
||
| 66 | For additional info please see "Puppet documentation":http://reductivelabs.com/trac/puppet/wiki/ExternalNodes |
||
| 67 | |||
| 68 | 2 | Ohad Levy | h2. Verify your setup |
| 69 | 1 | Ohad Levy | |
| 70 | You may also click on the YAML link to see the output that would be used for puppet external nodes. |