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