Project

General

Profile

Rundeck Integration » History » Version 2

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