abiquo-chef-agent 2.0.5 → 2.0.6

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGMyODk5YWExYjIzNjM5NTk2YzAyNGU4Y2ZlZDIwYThmZGIyOTc0Zg==
5
+ data.tar.gz: !binary |-
6
+ MDI4MGM3ODM4MDFlZTA4MzhkNGE5MWRmMmFjOGE0MTE0Mzg4NDYyOA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDk2ODZmZjQxODc0ZGJkMmNjN2EwNjRhZTNiMTA0YjEyOTNmZDdmYTNkNmU1
10
+ YzRiMzEwZjIzYzI0ZWE4N2I1YWNlNzkzYzgwOTlkY2Y1Yjk0ZjE0OTVhMjU2
11
+ NzdiYTZkODA4NjAyODk4MmYzMGJlMjQ3OTZjMGEyYzgzZTI4NjE=
12
+ data.tar.gz: !binary |-
13
+ Zjc1ZTJjYTNjNGM3NjQ4MDAxNTg5ZTZkM2VkOTJlNWQzMTU1YjcxNDEzMWQ0
14
+ YjFhYmJmMDkxMDFlM2E3NTU0MzFkMjQ2NWU0YWJjMzA1MThjYTliMDQ2NDNi
15
+ NDNjNGQyMjM1NDU1MjFhYWIwMDYyN2UwYmEyOWQ4ZmIyMTI0ZjA=
data/Gemfile CHANGED
@@ -1,9 +1,23 @@
1
- source 'https://rubygems.org'
1
+ # Copyright (C) 2008 Abiquo Holdings S.L.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ source 'http://rubygems.org'
2
16
 
3
17
  group :development do
4
- gem "rspec"
5
- gem "rspec-collection_matchers"
6
- gem "jeweler"
7
- gem "simplecov", ">= 0"
8
- gem "xml-simple"
18
+ gem 'xml-simple', '~> 1.1.5'
19
+ gem 'jeweler', '~> 2.0.1'
20
+ gem 'rspec', '~> 3.2.0'
21
+ gem 'rspec-collection_matchers', '~> 1.1.2'
22
+ gem 'simplecov', '~> 0.9.1'
9
23
  end
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md CHANGED
@@ -5,11 +5,21 @@ A simple boot time execution daemon that allow to execute the Chef configuration
5
5
 
6
6
  ## Installing
7
7
 
8
- Installation script currently targets a CentOS operating system. The script will install Chef and all the agent
9
- dependencies. The installation script must be run as root:
8
+ Installation script currently targets only CentOS and Ubuntu operating systems. The script will install Chef and
9
+ all the agent dependencies. The installation script must be run as root:
10
10
 
11
- chmod +x install.sh
12
- ./install.sh
11
+ chmod +x install-centos.sh
12
+ ./install-centos.sh
13
+
14
+ ## Building the gem
15
+
16
+ The build process has been tested on Ruby 1.9.3 and all gem versions have been pinned assuming this. Consider using a Ruby manager or you may have to manually fix some side issues.
17
+
18
+ gem install bundler # Only if the gem is not yet installed
19
+ bundle install
20
+ bundle exec rake
21
+
22
+ This will generate the `abiquo-chef-gem` in the `pkg` folder.
13
23
 
14
24
  ## Contributing to abiquo-chef-agent
15
25
 
@@ -23,4 +33,4 @@ dependencies. The installation script must be run as root:
23
33
 
24
34
  ## Copyright
25
35
 
26
- See LICENSE.txt for further details.
36
+ See LICENSE for further details.
data/Rakefile CHANGED
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2008 Abiquo Holdings S.L.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'rubygems'
2
16
  require 'rake'
3
17
  require './lib/abiquo-chef-agent.rb'
@@ -6,22 +20,21 @@ require 'rdoc/task'
6
20
  require 'rspec/core/rake_task'
7
21
 
8
22
  Jeweler::Tasks.new do |gem|
9
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
10
23
  gem.version = Abiquo::Chef::VERSION
11
-
12
24
  gem.name = "abiquo-chef-agent"
13
25
  gem.homepage = "http://github.com/abiquo/abiquo-chef-agent"
14
26
  gem.license = "MIT"
15
27
  gem.summary = %Q{Abiquo Chef Agent}
16
28
  gem.description = %Q{Abiquo Chef Agent}
17
- gem.email = "ruby-gems@abiquo.com"
29
+ gem.email = "support@abiquo.com"
18
30
  gem.authors = ["Salvador Girones", "Sergio Rubio", "Serafin Sedano", "Ignasi Barrera"]
19
- gem.add_runtime_dependency 'run-as-root'
20
31
  gem.add_runtime_dependency 'chef'
21
- gem.add_runtime_dependency 'daemons'
22
- gem.add_runtime_dependency 'rest-client'
23
- gem.add_runtime_dependency 'xml-simple'
24
- gem.add_development_dependency 'rspec', '> 1.2.3'
32
+ gem.add_runtime_dependency 'rest-client', '~> 1.8.0'
33
+ gem.add_runtime_dependency 'xml-simple', '~> 1.1.5'
34
+ gem.add_development_dependency 'jeweler', '~> 2.0.1'
35
+ gem.add_development_dependency 'rspec', '~> 3.2.0'
36
+ gem.add_development_dependency 'rspec-collection-matchers', '~> 1.1.2'
37
+ gem.add_development_dependency 'simplecov', '~> 0.9.1'
25
38
  end
26
39
 
27
40
  Jeweler::RubygemsDotOrgTasks.new
@@ -1,4 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (C) 2008 Abiquo Holdings S.L.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
2
17
  require 'rubygems'
3
18
  require 'fileutils'
4
19
  require 'rest-client'
@@ -73,7 +88,13 @@ else
73
88
  #
74
89
  log "Requesting Chef config from API #{leases[:abiquo_api_url]} OneTime #{leases[:abiquo_api_token]} Accept #{Abiquo::Chef::Config.bootstrap_mediatype}"
75
90
  begin
76
- xml = RestClient.get leases[:abiquo_api_url], :authorization => "OneTime #{leases[:abiquo_api_token]}", :accept => Abiquo::Chef::Config.bootstrap_mediatype
91
+ xml = RestClient::Resource.new(
92
+ leases[:abiquo_api_url],
93
+ :verify_ssl => OpenSSL::SSL::VERIFY_NONE
94
+ ).get(
95
+ :authorization => "OneTime #{leases[:abiquo_api_token]}",
96
+ :accept => Abiquo::Chef::Config.bootstrap_mediatype
97
+ )
77
98
  rescue Exception => e
78
99
  log "Error requesting node info from API", :error
79
100
  log e.message, :error
@@ -124,6 +145,7 @@ else
124
145
  f.puts "log_level :info"
125
146
  f.puts "log_location STDOUT"
126
147
  f.puts "chef_server_url '#{chef_server_url}'"
148
+ f.puts "ssl_verify_mode :verify_none"
127
149
  f.puts "validation_client_name '#{validation_client_name}'"
128
150
  end
129
151
 
@@ -1,4 +1,38 @@
1
1
  #!/bin/bash
2
+
3
+ # Copyright (C) 2008 Abiquo Holdings S.L.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ AGENT_GEM_VERSION=2.0.6
18
+
19
+ if [[ ${UID} -ne 0 ]]; then
20
+ echo "${0} must be run as root"
21
+ exit 1
22
+ fi
23
+
24
+ echo "Preparing the system..."
25
+ yum --assumeyes install ntp gcc-c++ libstdc++-devel
26
+
27
+ echo "Installing Chef..."
28
+ curl -L https://www.opscode.com/chef/install.sh | bash
29
+
30
+ echo "Installing the Abiquo Chef Agent gem..."
31
+ /opt/chef/embedded/bin/gem install abiquo-chef-agent -v ${AGENT_CHEF_VERSION}
32
+
33
+ ln -s /opt/chef/embedded/bin/abiquo-chef-run /usr/bin
34
+ cat > /etc/init.d/abiquo-chef-run << 'EOF'
35
+ #!/bin/bash
2
36
  #
3
37
  # abiquo-chef-run Startup script for the Abiquo Chef Agent
4
38
  #
@@ -99,3 +133,28 @@ case "$1" in
99
133
  exit 2
100
134
  esac
101
135
  exit $?
136
+ EOF
137
+
138
+ chmod +x /etc/init.d/abiquo-chef-run
139
+ chkconfig --add abiquo-chef-run
140
+ chkconfig abiquo-chef-run on
141
+
142
+ echo "Configuring DHCP..."
143
+ read -r -d '' DHCP << 'EOF'
144
+ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
145
+
146
+ send host-name "<hostname>";
147
+ request subnet-mask, broadcast-address, time-offset, routers,
148
+ domain-name, domain-name-servers, domain-search, host-name,
149
+ netbios-name-servers, netbios-scope, interface-mtu,
150
+ rfc3442-classless-static-routes, ntp-servers, vendor-encapsulated-options;
151
+ EOF
152
+
153
+ echo "${DHCP}" >/etc/dhcp/dhclient.conf
154
+
155
+ IFACES=`ip link show | grep ^[0-9]: | grep -iv loopback | cut -d: -f2 | tr -d ' '`
156
+ for IFACE in ${IFACES}; do
157
+ echo "${DHCP}" >/etc/dhcp/dhclient-${IFACE}.conf
158
+ done
159
+
160
+ echo "Done!"
@@ -0,0 +1,59 @@
1
+ #!/bin/bash
2
+
3
+ # Copyright (C) 2008 Abiquo Holdings S.L.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ AGENT_GEM_VERSION=2.0.6
18
+
19
+ if [[ `id -u` -ne 0 ]]; then
20
+ echo "${0} must be run with sudo"
21
+ exit 1
22
+ fi
23
+
24
+ echo "Preparing the system..."
25
+ apt-get update
26
+ apt-get install -y ntp build-essential
27
+
28
+ echo "Installing Chef..."
29
+ curl -L https://www.opscode.com/chef/install.sh | bash
30
+
31
+ echo "Installing the Abiquo Chef Agent gem..."
32
+ /opt/chef/embedded/bin/gem install abiquo-chef-agent -v ${AGENT_GEM_VERSION}
33
+
34
+ ln -s /opt/chef/embedded/bin/abiquo-chef-run /usr/bin
35
+ cat > /lib/systemd/system/abiquo-chef-agent.service << 'EOF'
36
+ [Unit]
37
+ Description=Abiquo Chef Agent
38
+
39
+ [Service]
40
+ ExecStart=/usr/bin/abiquo-chef-run
41
+
42
+ [Install]
43
+ WantedBy=network-online.target
44
+ EOF
45
+
46
+ systemctl enable abiquo-chef-agent
47
+
48
+ echo "Configuring DHCP..."
49
+ cat > /etc/dhcp/dhclient.conf << 'EOF'
50
+ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
51
+
52
+ send host-name "<hostname>";
53
+ request subnet-mask, broadcast-address, time-offset, routers,
54
+ domain-name, domain-name-servers, domain-search, host-name,
55
+ netbios-name-servers, netbios-scope, interface-mtu,
56
+ rfc3442-classless-static-routes, ntp-servers, vendor-encapsulated-options;
57
+ EOF
58
+
59
+ echo "Done!"
@@ -0,0 +1,60 @@
1
+ #!/bin/bash
2
+
3
+ # Copyright (C) 2008 Abiquo Holdings S.L.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ AGENT_GEM_VERSION=2.0.6
18
+
19
+ if [[ `id -u` -ne 0 ]]; then
20
+ echo "${0} must be run with sudo"
21
+ exit 1
22
+ fi
23
+
24
+ echo "Preparing the system..."
25
+ apt-get update
26
+ apt-get install -y ntp build-essential
27
+
28
+ echo "Installing Chef..."
29
+ curl -L https://www.opscode.com/chef/install.sh | bash
30
+
31
+ echo "Installing the Abiquo Chef Agent gem..."
32
+ /opt/chef/embedded/bin/gem install abiquo-chef-agent -v ${AGENT_GEM_VERSION}
33
+
34
+ ln -s /opt/chef/embedded/bin/abiquo-chef-run /usr/bin
35
+ cat > /etc/init/abiquo-chef-agent.conf << 'EOF'
36
+ # abiquo-chef-agent - Abiquo Chef Agent
37
+ #
38
+ # Configures the Abiquo Chef Agent daemon
39
+
40
+ description "Abiquo Chef Agent"
41
+
42
+ start on (local-filesystems
43
+ and net-device-up IFACE=eth0)
44
+
45
+ stop on runlevel [!2345]
46
+ exec /usr/bin/abiquo-chef-run
47
+ EOF
48
+
49
+ echo "Configuring DHCP..."
50
+ cat > /etc/dhcp/dhclient.conf << 'EOF'
51
+ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
52
+
53
+ send host-name "<hostname>";
54
+ request subnet-mask, broadcast-address, time-offset, routers,
55
+ domain-name, domain-name-servers, domain-search, host-name,
56
+ netbios-name-servers, netbios-scope, interface-mtu,
57
+ rfc3442-classless-static-routes, ntp-servers, vendor-encapsulated-options;
58
+ EOF
59
+
60
+ echo "Done!"
@@ -1,3 +1,17 @@
1
+ # Copyright (C) 2008 Abiquo Holdings S.L.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  require 'xmlsimple'
2
16
  require 'json'
3
17
  require 'time'
@@ -5,7 +19,7 @@ require 'time'
5
19
  module Abiquo
6
20
  module Chef
7
21
 
8
- VERSION="2.0.5"
22
+ VERSION = '2.0.6'
9
23
 
10
24
  class Config
11
25
  def self.chef_config_dir
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abiquo-chef-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
5
- prerelease:
4
+ version: 2.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Salvador Girones
@@ -12,92 +11,91 @@ authors:
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2015-02-11 00:00:00.000000000 Z
14
+ date: 2015-08-05 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
- name: rspec
17
+ name: xml-simple
19
18
  requirement: !ruby/object:Gem::Requirement
20
- none: false
21
19
  requirements:
22
- - - ! '>='
20
+ - - ~>
23
21
  - !ruby/object:Gem::Version
24
- version: '0'
22
+ version: !binary |-
23
+ MS4xLjU=
25
24
  type: :development
26
25
  prerelease: false
27
26
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
27
  requirements:
30
- - - ! '>='
28
+ - - ~>
31
29
  - !ruby/object:Gem::Version
32
- version: '0'
30
+ version: !binary |-
31
+ MS4xLjU=
33
32
  - !ruby/object:Gem::Dependency
34
- name: rspec-collection_matchers
33
+ name: jeweler
35
34
  requirement: !ruby/object:Gem::Requirement
36
- none: false
37
35
  requirements:
38
- - - ! '>='
36
+ - - ~>
39
37
  - !ruby/object:Gem::Version
40
- version: '0'
38
+ version: !binary |-
39
+ Mi4wLjE=
41
40
  type: :development
42
41
  prerelease: false
43
42
  version_requirements: !ruby/object:Gem::Requirement
44
- none: false
45
43
  requirements:
46
- - - ! '>='
44
+ - - ~>
47
45
  - !ruby/object:Gem::Version
48
- version: '0'
46
+ version: !binary |-
47
+ Mi4wLjE=
49
48
  - !ruby/object:Gem::Dependency
50
- name: jeweler
49
+ name: rspec
51
50
  requirement: !ruby/object:Gem::Requirement
52
- none: false
53
51
  requirements:
54
- - - ! '>='
52
+ - - ~>
55
53
  - !ruby/object:Gem::Version
56
- version: '0'
54
+ version: !binary |-
55
+ My4yLjA=
57
56
  type: :development
58
57
  prerelease: false
59
58
  version_requirements: !ruby/object:Gem::Requirement
60
- none: false
61
59
  requirements:
62
- - - ! '>='
60
+ - - ~>
63
61
  - !ruby/object:Gem::Version
64
- version: '0'
62
+ version: !binary |-
63
+ My4yLjA=
65
64
  - !ruby/object:Gem::Dependency
66
- name: simplecov
65
+ name: rspec-collection_matchers
67
66
  requirement: !ruby/object:Gem::Requirement
68
- none: false
69
67
  requirements:
70
- - - ! '>='
68
+ - - ~>
71
69
  - !ruby/object:Gem::Version
72
- version: '0'
70
+ version: !binary |-
71
+ MS4xLjI=
73
72
  type: :development
74
73
  prerelease: false
75
74
  version_requirements: !ruby/object:Gem::Requirement
76
- none: false
77
75
  requirements:
78
- - - ! '>='
76
+ - - ~>
79
77
  - !ruby/object:Gem::Version
80
- version: '0'
78
+ version: !binary |-
79
+ MS4xLjI=
81
80
  - !ruby/object:Gem::Dependency
82
- name: xml-simple
81
+ name: simplecov
83
82
  requirement: !ruby/object:Gem::Requirement
84
- none: false
85
83
  requirements:
86
- - - ! '>='
84
+ - - ~>
87
85
  - !ruby/object:Gem::Version
88
- version: '0'
86
+ version: !binary |-
87
+ MC45LjE=
89
88
  type: :development
90
89
  prerelease: false
91
90
  version_requirements: !ruby/object:Gem::Requirement
92
- none: false
93
91
  requirements:
94
- - - ! '>='
92
+ - - ~>
95
93
  - !ruby/object:Gem::Version
96
- version: '0'
94
+ version: !binary |-
95
+ MC45LjE=
97
96
  - !ruby/object:Gem::Dependency
98
- name: run-as-root
97
+ name: chef
99
98
  requirement: !ruby/object:Gem::Requirement
100
- none: false
101
99
  requirements:
102
100
  - - ! '>='
103
101
  - !ruby/object:Gem::Version
@@ -105,108 +103,121 @@ dependencies:
105
103
  type: :runtime
106
104
  prerelease: false
107
105
  version_requirements: !ruby/object:Gem::Requirement
108
- none: false
109
106
  requirements:
110
107
  - - ! '>='
111
108
  - !ruby/object:Gem::Version
112
109
  version: '0'
113
110
  - !ruby/object:Gem::Dependency
114
- name: chef
111
+ name: rest-client
115
112
  requirement: !ruby/object:Gem::Requirement
116
- none: false
117
113
  requirements:
118
- - - ! '>='
114
+ - - ~>
119
115
  - !ruby/object:Gem::Version
120
- version: '0'
116
+ version: 1.8.0
121
117
  type: :runtime
122
118
  prerelease: false
123
119
  version_requirements: !ruby/object:Gem::Requirement
124
- none: false
125
120
  requirements:
126
- - - ! '>='
121
+ - - ~>
127
122
  - !ruby/object:Gem::Version
128
- version: '0'
123
+ version: 1.8.0
129
124
  - !ruby/object:Gem::Dependency
130
- name: daemons
125
+ name: xml-simple
131
126
  requirement: !ruby/object:Gem::Requirement
132
- none: false
133
127
  requirements:
134
- - - ! '>='
128
+ - - ~>
135
129
  - !ruby/object:Gem::Version
136
- version: '0'
130
+ version: !binary |-
131
+ MS4xLjU=
137
132
  type: :runtime
138
133
  prerelease: false
139
134
  version_requirements: !ruby/object:Gem::Requirement
140
- none: false
141
135
  requirements:
142
- - - ! '>='
136
+ - - ~>
143
137
  - !ruby/object:Gem::Version
144
- version: '0'
138
+ version: !binary |-
139
+ MS4xLjU=
145
140
  - !ruby/object:Gem::Dependency
146
- name: rest-client
141
+ name: jeweler
147
142
  requirement: !ruby/object:Gem::Requirement
148
- none: false
149
143
  requirements:
150
- - - ! '>='
144
+ - - ~>
151
145
  - !ruby/object:Gem::Version
152
- version: '0'
153
- type: :runtime
146
+ version: !binary |-
147
+ Mi4wLjE=
148
+ type: :development
154
149
  prerelease: false
155
150
  version_requirements: !ruby/object:Gem::Requirement
156
- none: false
157
151
  requirements:
158
- - - ! '>='
152
+ - - ~>
159
153
  - !ruby/object:Gem::Version
160
- version: '0'
154
+ version: !binary |-
155
+ Mi4wLjE=
161
156
  - !ruby/object:Gem::Dependency
162
- name: xml-simple
157
+ name: rspec
163
158
  requirement: !ruby/object:Gem::Requirement
164
- none: false
165
159
  requirements:
166
- - - ! '>='
160
+ - - ~>
167
161
  - !ruby/object:Gem::Version
168
- version: '0'
169
- type: :runtime
162
+ version: !binary |-
163
+ My4yLjA=
164
+ type: :development
170
165
  prerelease: false
171
166
  version_requirements: !ruby/object:Gem::Requirement
172
- none: false
173
167
  requirements:
174
- - - ! '>='
168
+ - - ~>
175
169
  - !ruby/object:Gem::Version
176
- version: '0'
170
+ version: !binary |-
171
+ My4yLjA=
177
172
  - !ruby/object:Gem::Dependency
178
- name: rspec
173
+ name: rspec-collection-matchers
174
+ requirement: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ~>
177
+ - !ruby/object:Gem::Version
178
+ version: !binary |-
179
+ MS4xLjI=
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ~>
185
+ - !ruby/object:Gem::Version
186
+ version: !binary |-
187
+ MS4xLjI=
188
+ - !ruby/object:Gem::Dependency
189
+ name: simplecov
179
190
  requirement: !ruby/object:Gem::Requirement
180
- none: false
181
191
  requirements:
182
- - - ! '>'
192
+ - - ~>
183
193
  - !ruby/object:Gem::Version
184
- version: 1.2.3
194
+ version: !binary |-
195
+ MC45LjE=
185
196
  type: :development
186
197
  prerelease: false
187
198
  version_requirements: !ruby/object:Gem::Requirement
188
- none: false
189
199
  requirements:
190
- - - ! '>'
200
+ - - ~>
191
201
  - !ruby/object:Gem::Version
192
- version: 1.2.3
202
+ version: !binary |-
203
+ MC45LjE=
193
204
  description: Abiquo Chef Agent
194
- email: ruby-gems@abiquo.com
205
+ email: support@abiquo.com
195
206
  executables:
196
207
  - abiquo-chef-run
197
208
  extensions: []
198
209
  extra_rdoc_files:
199
- - LICENSE.txt
210
+ - LICENSE
200
211
  - README.md
201
212
  files:
202
213
  - Gemfile
203
- - LICENSE.txt
214
+ - LICENSE
204
215
  - README.md
205
216
  - Rakefile
206
217
  - bin/abiquo-chef-run
207
- - dist/centos/abiquo-chef-run
208
- - dist/centos/dhclient.conf
209
- - install.sh
218
+ - install/install-centos.sh
219
+ - install/install-ubuntu-systemd.sh
220
+ - install/install-ubuntu-upstart.sh
210
221
  - lib/abiquo-chef-agent.rb
211
222
  - spec/data/bootstrap.xml
212
223
  - spec/data/bootstrap_empty_cert.xml
@@ -231,29 +242,25 @@ files:
231
242
  homepage: http://github.com/abiquo/abiquo-chef-agent
232
243
  licenses:
233
244
  - MIT
245
+ metadata: {}
234
246
  post_install_message:
235
247
  rdoc_options: []
236
248
  require_paths:
237
249
  - lib
238
250
  required_ruby_version: !ruby/object:Gem::Requirement
239
- none: false
240
251
  requirements:
241
252
  - - ! '>='
242
253
  - !ruby/object:Gem::Version
243
254
  version: '0'
244
- segments:
245
- - 0
246
- hash: 2626624219569308421
247
255
  required_rubygems_version: !ruby/object:Gem::Requirement
248
- none: false
249
256
  requirements:
250
257
  - - ! '>='
251
258
  - !ruby/object:Gem::Version
252
259
  version: '0'
253
260
  requirements: []
254
261
  rubyforge_project:
255
- rubygems_version: 1.8.23
262
+ rubygems_version: 2.1.3
256
263
  signing_key:
257
- specification_version: 3
264
+ specification_version: 4
258
265
  summary: Abiquo Chef Agent
259
266
  test_files: []
@@ -1,21 +0,0 @@
1
- Copyright (c) 2011 Abiquo Inc.
2
- Copyright (c) 2011 Sergio Rubio <rubiojr@frameos.org>
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining
5
- a copy of this software and associated documentation files (the
6
- "Software"), to deal in the Software without restriction, including
7
- without limitation the rights to use, copy, modify, merge, publish,
8
- distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so, subject to
10
- the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,7 +0,0 @@
1
- option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
2
-
3
- send host-name "<hostname>";
4
- request subnet-mask, broadcast-address, time-offset, routers,
5
- domain-name, domain-name-servers, domain-search, host-name,
6
- netbios-name-servers, netbios-scope, interface-mtu,
7
- rfc3442-classless-static-routes, ntp-servers, vendor-encapsulated-options;
data/install.sh DELETED
@@ -1,33 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [[ ${UID} -ne 0 ]]; then
4
- echo "${0} must be run as root"
5
- exit 1
6
- fi
7
-
8
- DIST="dist/centos"
9
-
10
- echo "Installing NTP..."
11
- yum --quiet --assumeyes install ntp
12
-
13
- echo "Installing Chef..."
14
- curl -L https://www.opscode.com/chef/install.sh | bash
15
-
16
- echo "Installing the Abiquo Chef Agent gem..."
17
- /opt/chef/embedded/bin/gem install abiquo-chef-agent
18
-
19
- ln -s /opt/chef/embedded/bin/abiquo-chef-run /usr/bin
20
- cp ${DIST}/abiquo-chef-run /etc/init.d
21
- chmod +x /etc/init.d/abiquo-chef-run
22
-
23
- chkconfig --add abiquo-chef-run
24
- chkconfig abiquo-chef-run on
25
-
26
- echo "Configuring DHCP..."
27
- cp ${DIST}/dhclient.conf /etc/dhcp/
28
- IFACES=`ip link show | grep ^[0-9]: | grep -iv loopback | cut -d: -f2 | tr -d ' '`
29
- for IFACE in ${IFACES}; do
30
- cp ${DIST}/dhclient.conf /etc/dhcp/dhclient-${IFACE}.conf
31
- done
32
-
33
- echo "Done!"