Rundeck Integration » History » Version 1
Marcello de Sousa, 09/05/2011 04:46 AM
1 | 1 | Marcello de Sousa | h1. Rundeck Integration |
---|---|---|---|
2 | |||
3 | In case you want to know what Rundeck is: http://rundeck.org/docs/RunDeck-Guide.html#what-is-rundeck |
||
4 | |||
5 | Since version 0.4 Foreman supports Rundeck integration. It allows you to export a list of nodes (resources) as yaml to populate your Rundeck project. |
||
6 | |||
7 | |||
8 | h2. Basic setup |
||
9 | |||
10 | On your Rundeck server you might want to change your default resources file from XML to YAML: |
||
11 | |||
12 | Edit _/etc/rundeck/project.properties_ |
||
13 | <pre> |
||
14 | # The resources registration file |
||
15 | project.resources.file = /var/rundeck/projects/${project.name}/etc/resources.yaml |
||
16 | </pre> |
||
17 | |||
18 | Setup your project (here called _"examples"_) properties: |
||
19 | |||
20 | Edit _/var/rundeck/projects/examples/etc/project.properties_ |
||
21 | <pre> |
||
22 | # The resources registration file |
||
23 | project.resources.file = /var/rundeck/projects/examples/etc/resources.yaml |
||
24 | http://<foremanuser>:<foremanpasswd>@foreman.mydomain.local/hosts?rundeck=true&format=yaml |
||
25 | </pre> |
||
26 | |||
27 | Now, in Rundeck, when you press _"Update Nodes for project examples"_ it should import the information of all Foreman registered hosts and classes as tags. |
||
28 | |||
29 | |||
30 | |||
31 | h2. Advanced setup |
||
32 | |||
33 | Foreman supports some customization of what is supposed to be exported. |
||
34 | |||
35 | h3. 1- Export a subset of hosts (*Default = All hosts*) |
||
36 | |||
37 | You might only want to export a subset of your hosts (leveraged by Foreman's search engine). |
||
38 | Example - Export only machines that belong to the production environment: |
||
39 | on your _/var/rundeck/projects/examples/etc/project.properties_ change the URL to: |
||
40 | <pre> |
||
41 | # The resources registration file |
||
42 | project.resources.file = /var/rundeck/projects/examples/etc/resources.yaml |
||
43 | http://<foremanuser>:<foremanpasswd>@foreman.mydomain.local/hosts?search=+environment+%253D++production&rundeck=true&format=yaml |
||
44 | </pre> |
||
45 | |||
46 | h3. 2- Export specific facts as tags (*Default = classes only*) |
||
47 | |||
48 | Next to the classes, you might want configure a parameter in Foreman to export specific facts as Rundeck tags. This can be done for a single or multiple hosts. |
||
49 | |||
50 | Example - Export: environment and domain information |
||
51 | In Foreman, add a parameter *"rundeckfacts = domain,environment"* |
||
52 | |||
53 | h3. 3- Customize Rundeck user (*Default = root*) |
||
54 | |||
55 | You can customize the user Rundeck should use for logging in. This can be done for a single or multiple hosts. |
||
56 | |||
57 | Example - On my host _"myserver1.mydomain.local"_ I want to use a _"mycustomuser"_ instead of root |
||
58 | In Foreman, add a parameter *"rundeckuser = mycustomuser"* |
||
59 | |||
60 | |||
61 | h2. Troubleshooting |
||
62 | |||
63 | Be querying the server with curl you should see something like: |
||
64 | |||
65 | <pre> |
||
66 | $ curl -k -u admin:changeme "https://foreman/hosts/myserver1.mydomain.local?rundeck=true&format=yaml" |
||
67 | </pre> |
||
68 | |||
69 | <pre> |
||
70 | --- |
||
71 | myserver1.mydomain.local: |
||
72 | osFamily: Redhat |
||
73 | osVersion: "5.6" |
||
74 | tags: |
||
75 | - domain=mydomain.local |
||
76 | - environment=production |
||
77 | - class=ntp::main |
||
78 | - class=puppet::client |
||
79 | username: mycustomuser |
||
80 | osName: CentOS |
||
81 | osArch: x86_64 |
||
82 | nodename: myserver1.mydomain.local |
||
83 | description: My description specified in the HOST edit screen |
||
84 | hostname: myserver1.mydomain.local |
||
85 | </pre> |