puppet-rundeck-2013 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +15 -3
- data/VERSION +1 -1
- data/lib/puppet-rundeck.rb +46 -7
- metadata +51 -13
- checksums.yaml +0 -7
data/README.rdoc
CHANGED
@@ -54,15 +54,27 @@ To use with RunDeck specify the target URL as the value of the `project.resource
|
|
54
54
|
|
55
55
|
project.resources.url = http://localhost:8144
|
56
56
|
|
57
|
-
|
57
|
+
You can also specify a required tag to filter the node list, to provide different project URLs based
|
58
58
|
on the same puppet server and puppet-rundeck instance:
|
59
59
|
|
60
60
|
project.resources.url = http://localhost:8144/tag/production
|
61
61
|
|
62
|
+
In the version puppet-rundeck-2013 you can also pass configuration flags for puppet-rundeck.
|
63
|
+
|
64
|
+
- user=rundeck_ssh_username - to override SSH user for Rundeck
|
65
|
+
- use_tags=0 - to avoid adding default tags puppet from puppetmaster
|
66
|
+
- add_facts=fact1,fact2,fact3 - list of facter facts that will be added as tags for rundeck
|
67
|
+
|
68
|
+
Examples:
|
69
|
+
|
70
|
+
Add facts *fqdn* and *ipaddress* to list of tags, set SSH user to *root* and disable puppet-generated tags:
|
71
|
+
curl http://127.0.0.1:8144/?add_facts=fqdn,ipaddress&user=root&use_tags=0
|
72
|
+
|
73
|
+
|
62
74
|
You can specify some configuration options:
|
63
75
|
|
64
76
|
* -c or --config to override the default Puppet configuration file (defaults to `/etc/puppet/puppet.conf`)
|
65
|
-
* -u or --username the user for RunDeck to SSH as, defaults to current user
|
77
|
+
* -u or --username the user for RunDeck to SSH as, defaults to current user (you can override this value via URL, using *user* parameter)
|
66
78
|
* -p or --port the port to start `puppet-rundeck` on, default to 8144
|
67
79
|
|
68
80
|
== Credits
|
@@ -71,4 +83,4 @@ Original concept heavily stolen from Adam Jacob's chef-rundeck gem
|
|
71
83
|
|
72
84
|
== Copyright
|
73
85
|
|
74
|
-
Copyright (c) 2011 James Turnbull. See LICENSE for details.
|
86
|
+
Copyright (c) 2011 James Turnbull. Few modifications by Aleksey Timohin. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
data/lib/puppet-rundeck.rb
CHANGED
@@ -42,9 +42,15 @@ class PuppetRundeck < Sinatra::Base
|
|
42
42
|
return input.to_s.to_xs
|
43
43
|
end
|
44
44
|
|
45
|
-
def respond(required_tag=nil,uname=nil)
|
45
|
+
def respond(required_tag=nil,uname=nil,use_tags=nil,add_facts=nil)
|
46
46
|
response['Content-Type'] = 'text/xml'
|
47
47
|
response_xml = %Q(<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd">\n<project>\n)
|
48
|
+
|
49
|
+
if use_tags.nil?
|
50
|
+
use_tags = '1'
|
51
|
+
end
|
52
|
+
should_use_tags = (! required_tag.nil?) || (use_tags == '1')
|
53
|
+
|
48
54
|
# Fix for 2.6 to 2.7 indirection difference
|
49
55
|
Puppet[:clientyamldir] = Puppet[:yamldir]
|
50
56
|
if Puppet::Node.respond_to? :terminus_class
|
@@ -54,23 +60,56 @@ class PuppetRundeck < Sinatra::Base
|
|
54
60
|
Puppet::Node.indirection.terminus_class = :yaml
|
55
61
|
nodes = Puppet::Node.indirection.search("*")
|
56
62
|
end
|
63
|
+
|
57
64
|
nodes.each do |n|
|
58
|
-
if
|
59
|
-
|
65
|
+
if should_use_tags
|
66
|
+
if Puppet::Node::Facts.respond_to? :find
|
67
|
+
tags = Puppet::Resource::Catalog.find(n.name).tags
|
68
|
+
else
|
69
|
+
tags = Puppet::Resource::Catalog.indirection.find(n.name).tags
|
70
|
+
end
|
60
71
|
else
|
61
|
-
tags =
|
72
|
+
tags = nil
|
62
73
|
end
|
74
|
+
|
63
75
|
if ! required_tag.nil?
|
64
76
|
next if ! tags.include? required_tag
|
65
77
|
end
|
78
|
+
|
66
79
|
facts = n.parameters
|
67
80
|
os_family = facts["kernel"] =~ /windows/i ? 'windows' : 'unix'
|
68
81
|
|
82
|
+
facts_string = nil
|
83
|
+
|
84
|
+
if !add_facts.nil?
|
85
|
+
add_facts.split(/,|;| +/).each { |fact_name|
|
86
|
+
fact = facts[fact_name]
|
87
|
+
if (!fact.nil?) and (!fact.empty?)
|
88
|
+
if facts_string.nil?
|
89
|
+
facts_string = fact
|
90
|
+
else
|
91
|
+
facts_string = [facts_string, fact].join(',')
|
92
|
+
end
|
93
|
+
end
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
69
97
|
if uname == nil
|
70
98
|
targetusername = PuppetRundeck.username
|
71
99
|
else
|
72
100
|
targetusername = uname
|
73
101
|
end
|
102
|
+
|
103
|
+
if tags.nil?
|
104
|
+
tags_string = n.environment
|
105
|
+
else
|
106
|
+
tags_string = [n.environment, tags.join(',')].join(',')
|
107
|
+
end
|
108
|
+
|
109
|
+
if !facts_string.nil?
|
110
|
+
tags_string = [tags_string,facts_string].join(',')
|
111
|
+
end
|
112
|
+
|
74
113
|
response_xml << <<-EOH
|
75
114
|
<node name="#{xml_escape(n.name)}"
|
76
115
|
type="Node"
|
@@ -79,7 +118,7 @@ class PuppetRundeck < Sinatra::Base
|
|
79
118
|
osFamily="#{xml_escape(os_family)}"
|
80
119
|
osName="#{xml_escape(facts["operatingsystem"])}"
|
81
120
|
osVersion="#{xml_escape(facts["operatingsystemrelease"])}"
|
82
|
-
tags="#{xml_escape(
|
121
|
+
tags="#{xml_escape(tags_string)}"
|
83
122
|
username="#{xml_escape(targetusername)}"
|
84
123
|
hostname="#{xml_escape(facts["ipaddress"] + ":" + PuppetRundeck.ssh_port.to_s)}"/>
|
85
124
|
EOH
|
@@ -91,11 +130,11 @@ EOH
|
|
91
130
|
require 'pp'
|
92
131
|
|
93
132
|
get '/tag/:tag' do
|
94
|
-
respond(params[:tag], params["user"])
|
133
|
+
respond(params[:tag], params["user"], params["use_tags"], params["add_facts"])
|
95
134
|
end
|
96
135
|
|
97
136
|
get '/' do
|
98
|
-
respond
|
137
|
+
respond(nil, params["user"], params["use_tags"], params["add_facts"])
|
99
138
|
end
|
100
139
|
|
101
140
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-rundeck-2013
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 9
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- James Turnbull, Aleksejs Timohins
|
@@ -9,16 +15,20 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2013-
|
18
|
+
date: 2013-10-03 00:00:00 +00:00
|
19
|
+
default_executable: puppet-rundeck
|
13
20
|
dependencies:
|
14
21
|
- !ruby/object:Gem::Dependency
|
15
22
|
name: sinatra
|
16
23
|
prerelease: false
|
17
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
18
26
|
requirements:
|
19
|
-
-
|
20
|
-
- ">="
|
27
|
+
- - ">="
|
21
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
22
32
|
version: "0"
|
23
33
|
type: :runtime
|
24
34
|
version_requirements: *id001
|
@@ -26,9 +36,15 @@ dependencies:
|
|
26
36
|
name: builder
|
27
37
|
prerelease: false
|
28
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
29
40
|
requirements:
|
30
41
|
- - ">="
|
31
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 15
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 0
|
47
|
+
- 0
|
32
48
|
version: 2.0.0
|
33
49
|
type: :runtime
|
34
50
|
version_requirements: *id002
|
@@ -36,20 +52,32 @@ dependencies:
|
|
36
52
|
name: rspec
|
37
53
|
prerelease: false
|
38
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
39
56
|
requirements:
|
40
57
|
- - ">="
|
41
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 13
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 2
|
63
|
+
- 9
|
42
64
|
version: 1.2.9
|
43
65
|
type: :development
|
44
66
|
version_requirements: *id003
|
45
67
|
- !ruby/object:Gem::Dependency
|
46
68
|
name: yard
|
47
69
|
prerelease: false
|
48
|
-
requirement: &
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
49
72
|
requirements:
|
50
|
-
-
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
51
79
|
type: :development
|
52
|
-
version_requirements: *
|
80
|
+
version_requirements: *id004
|
53
81
|
description: Provides a resource endpoint for RunDeck from a Puppet Server
|
54
82
|
email: LazyDelphiBuilder@gmail.com
|
55
83
|
executables:
|
@@ -68,30 +96,40 @@ files:
|
|
68
96
|
- spec/puppet-rundesk_spec.rb
|
69
97
|
- spec/spec_helper.rb
|
70
98
|
- bin/puppet-rundeck
|
99
|
+
has_rdoc: true
|
71
100
|
homepage: http://github.com/jamtur01/puppet-rundeck
|
72
101
|
licenses: []
|
73
102
|
|
74
|
-
metadata: {}
|
75
|
-
|
76
103
|
post_install_message:
|
77
104
|
rdoc_options:
|
78
105
|
- --charset=UTF-8
|
79
106
|
require_paths:
|
80
107
|
- lib
|
81
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
82
110
|
requirements:
|
83
|
-
-
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
84
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
85
119
|
requirements:
|
86
|
-
-
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
87
126
|
requirements: []
|
88
127
|
|
89
128
|
rubyforge_project:
|
90
|
-
rubygems_version:
|
129
|
+
rubygems_version: 1.3.7
|
91
130
|
signing_key:
|
92
131
|
specification_version: 3
|
93
132
|
summary: Integrates Puppet with RunDeck
|
94
133
|
test_files:
|
95
134
|
- spec/puppet-rundesk_spec.rb
|
96
135
|
- spec/spec_helper.rb
|
97
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
data.tar.gz: 0979a2d10f17c3271961a4a4909a884b702da0a6
|
4
|
-
metadata.gz: 3727fe4c70a007bc5c7f01c7486a8c1f2a9d13c5
|
5
|
-
SHA512:
|
6
|
-
data.tar.gz: 3691c5cf9813d5b09c75a0c137c0d94aa554ac487b12dad737a44604e8ede6f84c267a66011c0e4366b47d4f43129012545f3e3922abc597868bfcfe8e4ff754
|
7
|
-
metadata.gz: 0a950e0102400254bb518fedfeace03b5b8e55ada9ef14950a3f87d2873ec3901eac26b336dfff76b8732bfde214d1a452542b46b334d480cf9846f7b37a7956
|