puppet-rundeck 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +17 -12
  2. data/Rakefile +1 -0
  3. data/VERSION +1 -1
  4. data/lib/puppet-rundeck.rb +13 -12
  5. metadata +26 -12
data/README.rdoc CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Integrates Puppet with RunDeck.
4
4
 
5
- It assumes you have Puppet stored configuration running.
6
-
7
5
  Visiting the URL, for example localhost:8144, should return
8
- a list of all stored configuration nodes and populate the appropriate
9
- facts for use with RunDeck.
6
+ a list of all nodes on the Puppet master and populates the
7
+ appropriate facts for use with RunDeck.
8
+
9
+ Note: Version 0.0.2 required stored configuration to be enabled. Later versions do not.
10
10
 
11
11
  == Prerequisites
12
12
 
13
13
  Requires:
14
14
 
15
- - Puppet (with Stored Configuration enabled)
16
- - Builder (2.0.0 and later)
15
+ - Puppet
16
+ - Builder (2.0.0 and later)
17
17
 
18
18
  == Installation
19
19
 
@@ -31,13 +31,13 @@ Then browse to appropriate URL, by default `localhost:8144`
31
31
 
32
32
  $ curl localhost:8144
33
33
 
34
- A list of the current stored hosts and appropriate facts to configure them on RunDeck will be returned in XML.
34
+ A list of the current hosts and appropriate facts to configure them on RunDeck will be returned in XML.
35
35
 
36
36
  For example:
37
37
 
38
38
  <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd">
39
39
  <project>
40
- <h name="pelin.lovedthanlost.net"
40
+ <node name="pelin.lovedthanlost.net"
41
41
  type="Node"
42
42
  description="pelin.lovedthanlost.net"
43
43
  osArch="Linux"
@@ -46,14 +46,19 @@ For example:
46
46
  osVersion="14"
47
47
  tags="nil"
48
48
  username="root"
49
- hostname="pelin.lovedthanlost.net"
49
+ hostname="pelin.lovedthanlost.net"/>
50
50
  </project>
51
51
 
52
+ To use with RunDeck specify the target URL as the value of the `project.resources.url` option in the
53
+ `project.properties` file for your project, for example:
54
+
55
+ project.resources.url = http://localhost:8144
56
+
52
57
  You can specify some configuration options:
53
58
 
54
- * -c or --config to override the default Puppet configuration file (defaults to `/etc/puppet/puppet.conf`)
55
- * -u or --username the user for RunDeck to SSH as, defaults to current user
56
- * -p or --port the port to start `puppet-rundeck` on, default to 8144
59
+ * -c or --config to override the default Puppet configuration file (defaults to `/etc/puppet/puppet.conf`)
60
+ * -u or --username the user for RunDeck to SSH as, defaults to current user
61
+ * -p or --port the port to start `puppet-rundeck` on, default to 8144
57
62
 
58
63
  == Credits
59
64
 
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gem.email = "james@puppetlabs.com"
13
13
  gem.homepage = "http://github.com/jamtur01/puppet-rundeck"
14
14
  gem.authors = ["James Turnbull"]
15
+ gem.add_dependency "sinatra"
15
16
  gem.add_dependency "puppet", ">= 0.24.8"
16
17
  gem.add_dependency "builder", ">= 2.0.0"
17
18
  gem.add_development_dependency "rspec", ">= 1.2.9"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -26,11 +26,11 @@ class PuppetRundeck < Sinatra::Base
26
26
  class << self
27
27
  attr_accessor :config_file
28
28
  attr_accessor :username
29
+ attr_accessor :source
29
30
 
30
31
  def configure
31
32
  Puppet[:config] = PuppetRundeck.config_file
32
33
  Puppet.parse_config
33
- Puppet::Rails.connect
34
34
  end
35
35
  end
36
36
 
@@ -41,21 +41,22 @@ class PuppetRundeck < Sinatra::Base
41
41
 
42
42
  get '/' do
43
43
  response = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd"><project>'
44
- Host = Puppet::Rails::Host
45
- Host.all.each do |h|
46
- puts "Processing #{h.name}"
47
- facts = h.get_facts_hash
44
+ Puppet::Node::Facts.terminus_class = :yaml
45
+ Puppet[:clientyamldir] = "$yamldir"
46
+ nodes = Puppet::Node::Facts.search("*")
47
+ nodes.each do |n|
48
+ puts "Processing #{n.name}"
48
49
  response << <<-EOH
49
- <node name="#{xml_escape(h.name)}"
50
+ <node name="#{xml_escape(n.name)}"
50
51
  type="Node"
51
- description="#{xml_escape(h.name)}"
52
- osArch="#{xml_escape(facts["kernel"].first.value)}"
53
- osFamily="#{xml_escape(facts["kernel"].first.value)}"
54
- osName="#{xml_escape(facts["operatingsystem"].first.value)}"
55
- osVersion="#{xml_escape(facts["operatingsystemrelease"].first.value)}"
52
+ description="#{xml_escape(n.name)}"
53
+ osArch="#{xml_escape(n.values["kernel"])}"
54
+ osFamily="#{xml_escape(n.values["kernel"])}"
55
+ osName="#{xml_escape(n.values["operatingsystem"])}"
56
+ osVersion="#{xml_escape(n.values["operatingsystemrelease"])}"
56
57
  tags="nil"
57
58
  username="#{xml_escape(PuppetRundeck.username)}"
58
- hostname="#{xml_escape(facts["fqdn"].first.value)}"/>
59
+ hostname="#{xml_escape(n.values["fqdn"])}"/>
59
60
  EOH
60
61
  end
61
62
  response << "</project>"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-rundeck
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Turnbull
@@ -15,13 +15,27 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-26 00:00:00 -08:00
18
+ date: 2011-01-11 00:00:00 -08:00
19
19
  default_executable: puppet-rundeck
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: puppet
22
+ name: sinatra
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: puppet
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
25
39
  none: false
26
40
  requirements:
27
41
  - - ">="
@@ -33,11 +47,11 @@ dependencies:
33
47
  - 8
34
48
  version: 0.24.8
35
49
  type: :runtime
36
- version_requirements: *id001
50
+ version_requirements: *id002
37
51
  - !ruby/object:Gem::Dependency
38
52
  name: builder
39
53
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
54
+ requirement: &id003 !ruby/object:Gem::Requirement
41
55
  none: false
42
56
  requirements:
43
57
  - - ">="
@@ -49,11 +63,11 @@ dependencies:
49
63
  - 0
50
64
  version: 2.0.0
51
65
  type: :runtime
52
- version_requirements: *id002
66
+ version_requirements: *id003
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: rspec
55
69
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
70
+ requirement: &id004 !ruby/object:Gem::Requirement
57
71
  none: false
58
72
  requirements:
59
73
  - - ">="
@@ -65,11 +79,11 @@ dependencies:
65
79
  - 9
66
80
  version: 1.2.9
67
81
  type: :development
68
- version_requirements: *id003
82
+ version_requirements: *id004
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: yard
71
85
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
73
87
  none: false
74
88
  requirements:
75
89
  - - ">="
@@ -79,7 +93,7 @@ dependencies:
79
93
  - 0
80
94
  version: "0"
81
95
  type: :development
82
- version_requirements: *id004
96
+ version_requirements: *id005
83
97
  description: Provides a resource endpoint for RunDeck from a Puppet Server
84
98
  email: james@puppetlabs.com
85
99
  executables: