vagrant-puppet-modules 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +11 -0
- data/LICENSE +22 -0
- data/README.md +41 -0
- data/Rakefile +3 -0
- data/lib/vagrant-puppet-modules/action/install_librarian_puppet.rb +139 -0
- data/lib/vagrant-puppet-modules/action/install_puppet_modules.rb +74 -0
- data/lib/vagrant-puppet-modules/config.rb +83 -0
- data/lib/vagrant-puppet-modules/plugin.rb +49 -0
- data/lib/vagrant-puppet-modules/version.rb +5 -0
- data/lib/vagrant-puppet-modules.rb +3 -0
- data/shell/librarian_puppet_install.sh +109 -0
- data/vagrant-puppet-modules.gemspec +22 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 95c691b79233fe1f8344243c6046b70c96bc6886
|
4
|
+
data.tar.gz: d984b14d6dd35209a3b434d131aec621dd3a8529
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 50ab4a52be71af2aafe8e2cf6afa66ab08bbbcc0d912d29e51c222729f4eb41b30e9dcb8fb6ef6e9163657dbcd85fcd0e667445761bebe9bfa7108bd68bd38a2
|
7
|
+
data.tar.gz: a11f2fe571c456b7f9eb51713e7d204f6157511dbac3ccddfd33a5b00947f5a659374168cd98e1829b9594dfec981c22015a207ca95cf57e43544c96df75334a
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Anis Safine
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# vagrant-puppet-modules
|
2
|
+
A [Vagrant][1] plugin to install [Puppet][2] modules on the guest machine using [Librarian-Puppet][3].
|
3
|
+
|
4
|
+
## Requirements
|
5
|
+
* Vagrant 1.1.0 or greater
|
6
|
+
* Any version of puppet installed on your guest machine (you can use the plugin [vagrant-puppet-install][4])
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```sh
|
11
|
+
vagrant plugin install vagrant-puppet-modules
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
In your Vagrantfile, add:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Vagrant.configure("2") do |config|
|
19
|
+
# Version number of librarian-puppet that should be installed on your guest machine
|
20
|
+
# config.puppet_modules.librarian_version = "1.2.0" # specific version of librarian-puppet
|
21
|
+
config.puppet_modules.librarian_version = :latest
|
22
|
+
|
23
|
+
# Path to the folder that contains your Puppetfile (relative to the Vagrantfile folder)
|
24
|
+
config.puppet_modules.puppetfile_dir = "puppet"
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
This configuration will :
|
29
|
+
* install the latest version of librarian-puppet on your guest machine
|
30
|
+
* install the puppet modules defined in "puppet/Puppetfile" in "/etc/puppet/modules" via librarian-puppet
|
31
|
+
|
32
|
+
Feel free to learn more about [Librarian-Puppet][3] to know what to put in your Puppetfile.
|
33
|
+
|
34
|
+
## Acknowledgements
|
35
|
+
A huge thanks to both [vagrant-librarian-puppet][5] and [vagrant-puppet-install][4] that inspired this plugin.
|
36
|
+
|
37
|
+
[1]: http://www.vagrantup.com
|
38
|
+
[2]: https://puppetlabs.com/
|
39
|
+
[3]: https://github.com/rodjek/librarian-puppet
|
40
|
+
[4]: https://github.com/petems/vagrant-puppet-install
|
41
|
+
[5]: https://github.com/mhahn/vagrant-librarian-puppet
|
data/Rakefile
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
require 'vagrant/util/downloader'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module PuppetModules
|
6
|
+
module Action
|
7
|
+
class InstallLibrarianPuppet
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
@machine = env[:machine]
|
12
|
+
@logger = Log4r::Logger.new('vagrantplugins::puppet_modules::action::installlibrarian')
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
if @machine.communicate.ready? && provision_enabled?(env)
|
17
|
+
@machine.config.puppet_modules.validate!
|
18
|
+
|
19
|
+
desired_version = @machine.config.puppet_modules.librarian_version
|
20
|
+
if desired_version.nil? || installed_version == desired_version
|
21
|
+
env[:ui].info "Librarian-puppet is installed or not required"
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
fetch_or_create_install_script(env)
|
26
|
+
install(desired_version, env)
|
27
|
+
end
|
28
|
+
|
29
|
+
@app.call(env)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def provision_enabled?(env)
|
35
|
+
env.fetch(:provision_enabled, true)
|
36
|
+
end
|
37
|
+
|
38
|
+
def windows_guest?
|
39
|
+
@machine.config.vm.guest.eql?(:windows)
|
40
|
+
end
|
41
|
+
|
42
|
+
def installed_version
|
43
|
+
version = nil
|
44
|
+
opts = nil
|
45
|
+
|
46
|
+
if windows_guest?
|
47
|
+
# todo
|
48
|
+
else
|
49
|
+
command = 'echo $(librarian-puppet --version)'
|
50
|
+
end
|
51
|
+
|
52
|
+
@machine.communicate.sudo(command, opts) do |type, data|
|
53
|
+
if [:stderr, :stdout].include?(type)
|
54
|
+
version_match = data.match(/^(.+)/)
|
55
|
+
version = version_match.captures[0].strip if version_match
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
version
|
60
|
+
end
|
61
|
+
|
62
|
+
def fetch_or_create_install_script(env)
|
63
|
+
@script_tmp_path = env[:tmp_path].join("#{Time.now.to_i.to_s}-#{install_script_name}")
|
64
|
+
|
65
|
+
msg = "Generating install script at: #{@script_tmp_path}"
|
66
|
+
env[:ui].info(msg)
|
67
|
+
@logger.info(msg)
|
68
|
+
|
69
|
+
url = find_install_script
|
70
|
+
|
71
|
+
begin
|
72
|
+
if windows_guest?
|
73
|
+
# todo
|
74
|
+
else
|
75
|
+
downloader = Vagrant::Util::Downloader.new(url, @script_tmp_path, {})
|
76
|
+
downloader.download!
|
77
|
+
end
|
78
|
+
rescue Vagrant::Errors::DownloaderInterrupted
|
79
|
+
msg = 'The download of the librarian-puppet install script was interrupted'
|
80
|
+
env[:ui].info(msg)
|
81
|
+
@logger.info(msg)
|
82
|
+
return
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def find_install_script
|
87
|
+
config_install_url || default_install_url
|
88
|
+
end
|
89
|
+
|
90
|
+
def config_install_url
|
91
|
+
@machine.config.puppet_modules.install_url
|
92
|
+
end
|
93
|
+
|
94
|
+
def default_install_url
|
95
|
+
if windows_guest?
|
96
|
+
# todo
|
97
|
+
else
|
98
|
+
'https://raw.githubusercontent.com/anis/vagrant-puppet-modules/master/shell/librarian_puppet_install.sh'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def install_script_name
|
103
|
+
if windows_guest?
|
104
|
+
# todo
|
105
|
+
else
|
106
|
+
'librarian_puppet_install.sh'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def install(version, env)
|
111
|
+
msg = "Installing librarian-puppet at version #{version}"
|
112
|
+
env[:ui].info(msg)
|
113
|
+
@logger.info(msg)
|
114
|
+
|
115
|
+
shell_escaped_version = Shellwords.escape(version)
|
116
|
+
|
117
|
+
@machine.communicate.tap do |comm|
|
118
|
+
comm.upload(@script_tmp_path, install_script_name)
|
119
|
+
|
120
|
+
if windows_guest?
|
121
|
+
# todo
|
122
|
+
else
|
123
|
+
install_cmd = "sh #{install_script_name}"
|
124
|
+
install_cmd << " -v #{version}"
|
125
|
+
install_cmd << ' 2>&1'
|
126
|
+
end
|
127
|
+
|
128
|
+
comm.sudo(install_cmd) do |type, data|
|
129
|
+
if [:stderr, :stdout].include?(type)
|
130
|
+
next if data =~ /stdin: is not a tty/
|
131
|
+
env[:ui].info(data)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module PuppetModules
|
3
|
+
module Action
|
4
|
+
class InstallPuppetModules
|
5
|
+
|
6
|
+
def initialize(app, env)
|
7
|
+
@app = app
|
8
|
+
@machine = env[:machine]
|
9
|
+
@logger = Log4r::Logger.new('vagrantplugins::puppet_modules::action::installmodules')
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
if @machine.communicate.ready? && provision_enabled?(env)
|
14
|
+
if @machine.config.puppet_modules.puppetfile_dir.nil?
|
15
|
+
env[:ui].info "Puppetfile is not defined, puppet modules won't be installed"
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
install_modules(env)
|
20
|
+
end
|
21
|
+
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def provision_enabled?(env)
|
28
|
+
env.fetch(:provision_enabled, true)
|
29
|
+
end
|
30
|
+
|
31
|
+
def windows_guest?
|
32
|
+
@machine.config.vm.guest.eql?(:windows)
|
33
|
+
end
|
34
|
+
|
35
|
+
def install_modules(env)
|
36
|
+
msg = "Installing puppet modules via librarian"
|
37
|
+
env[:ui].info(msg)
|
38
|
+
@logger.info(msg)
|
39
|
+
|
40
|
+
@puppetfile_path = File.join(
|
41
|
+
env[:root_path],
|
42
|
+
@machine.config.puppet_modules.puppetfile_dir,
|
43
|
+
"Puppetfile"
|
44
|
+
)
|
45
|
+
|
46
|
+
if !File.file?(@puppetfile_path)
|
47
|
+
msg = "The file '" << @puppetfile_path << "' does not exist"
|
48
|
+
@logger.error(msg)
|
49
|
+
env[:ui].info msg
|
50
|
+
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
54
|
+
@machine.communicate.tap do |comm|
|
55
|
+
comm.upload(@puppetfile_path, "Puppetfile")
|
56
|
+
|
57
|
+
if windows_guest?
|
58
|
+
# todo
|
59
|
+
else
|
60
|
+
install_cmd = "librarian-puppet install --path=/etc/puppet/modules"
|
61
|
+
end
|
62
|
+
|
63
|
+
comm.sudo(install_cmd) do |type, data|
|
64
|
+
if [:stderr, :stdout].include?(type)
|
65
|
+
next if data =~ /stdin: is not a tty/
|
66
|
+
env[:ui].info(data)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
require 'rubygems/dependency'
|
3
|
+
require 'rubygems/dependency_installer'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module PuppetModules
|
7
|
+
class Config < Vagrant.plugin('2', :config)
|
8
|
+
attr_accessor :librarian_version, :install_url, :puppetfile_dir
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@librarian_version = UNSET_VALUE
|
12
|
+
@install_url = UNSET_VALUE
|
13
|
+
@puppetfile_dir = UNSET_VALUE
|
14
|
+
@logger = Log4r::Logger.new('vagrantplugins::puppet_modules::config')
|
15
|
+
end
|
16
|
+
|
17
|
+
def finalize!
|
18
|
+
if @librarian_version == UNSET_VALUE
|
19
|
+
@librarian_version = nil
|
20
|
+
elsif @librarian_version.to_s == 'latest'
|
21
|
+
@librarian_version = retrieve_latest_librarian_version
|
22
|
+
end
|
23
|
+
|
24
|
+
@install_url = nil if @install_url == UNSET_VALUE
|
25
|
+
@puppetfile_dir = nil if @puppetfile_dir == UNSET_VALUE
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate!()
|
29
|
+
finalize!
|
30
|
+
|
31
|
+
if !librarian_version.nil? && !valid_librarian_version?(librarian_version)
|
32
|
+
errors = Vagrant::Util::TemplateRenderer.render(
|
33
|
+
'config/validation_failed',
|
34
|
+
errors: {
|
35
|
+
'vagrant-puppet-modules' => [
|
36
|
+
"#{librarian_version} is not a valid version of librarian-puppet."
|
37
|
+
]
|
38
|
+
}
|
39
|
+
)
|
40
|
+
fail Vagrant::Errors::ConfigInvalid, errors: errors
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def retrieve_latest_librarian_version
|
47
|
+
available_gems = dependency_installer.find_gems_with_sources(librarian_gem_dependency)
|
48
|
+
|
49
|
+
spec, _source =
|
50
|
+
if available_gems.respond_to?(:last)
|
51
|
+
spec_with_source = available_gems.last
|
52
|
+
spec_with_source
|
53
|
+
else
|
54
|
+
available_gems.pick_best!
|
55
|
+
best_gem = available_gems.set.first
|
56
|
+
best_gem && [best_gem.spec, best_gem.source]
|
57
|
+
end
|
58
|
+
|
59
|
+
spec && spec.version.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def valid_librarian_version?(version)
|
63
|
+
is_valid = false
|
64
|
+
begin
|
65
|
+
available = dependency_installer.find_gems_with_sources(librarian_gem_dependency(version))
|
66
|
+
is_valid = true unless available.empty?
|
67
|
+
rescue ArgumentError => e
|
68
|
+
@logger.debug("#{version} is not a valid librarian-puppet version: #{e}")
|
69
|
+
end
|
70
|
+
|
71
|
+
is_valid
|
72
|
+
end
|
73
|
+
|
74
|
+
def dependency_installer
|
75
|
+
@dependency_installer ||= Gem::DependencyInstaller.new
|
76
|
+
end
|
77
|
+
|
78
|
+
def librarian_gem_dependency(version = nil)
|
79
|
+
Gem::Dependency.new('librarian-puppet', version)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module PuppetModules
|
3
|
+
class Plugin < Vagrant.plugin('2')
|
4
|
+
name 'vagrant-puppet-modules'
|
5
|
+
description <<-DESC
|
6
|
+
This plugin installs the appropriate Puppet modules on your guest machine, via librarian-puppet.
|
7
|
+
DESC
|
8
|
+
|
9
|
+
VAGRANT_VERSION_REQUIREMENT = '>= 1.1.0'
|
10
|
+
|
11
|
+
# Returns true if the Vagrant version fulfills the requirements
|
12
|
+
#
|
13
|
+
# @param requirements [String, Array<String>] the version requirement
|
14
|
+
# @return [Boolean]
|
15
|
+
def self.check_vagrant_version(*requirements)
|
16
|
+
Gem::Requirement.new(*requirements).satisfied_by?(
|
17
|
+
Gem::Version.new(Vagrant::VERSION)
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Verifies that the Vagrant version fulfills the requirements
|
22
|
+
#
|
23
|
+
# @raise [VagrantPlugins::ProxyConf::VagrantVersionError] if this plugin is incompatible with the Vagrant
|
24
|
+
# version
|
25
|
+
def self.check_vagrant_version!
|
26
|
+
unless check_vagrant_version(VAGRANT_VERSION_REQUIREMENT)
|
27
|
+
msg = "vagrant-puppet-modules requires Vagrant version " << VAGRANT_VERSION_REQUIREMENT
|
28
|
+
$stderr.puts msg
|
29
|
+
fail msg
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
action_hook(:install_librarian_puppet, Plugin::ALL_ACTIONS) do |hook|
|
34
|
+
require_relative 'action/install_puppet_modules'
|
35
|
+
require_relative 'action/install_librarian_puppet'
|
36
|
+
|
37
|
+
hook.after(Vagrant::Action::Builtin::Provision, Action::InstallLibrarianPuppet)
|
38
|
+
hook.after(Action::InstallLibrarianPuppet, Action::InstallPuppetModules)
|
39
|
+
end
|
40
|
+
|
41
|
+
check_vagrant_version!
|
42
|
+
|
43
|
+
config(:puppet_modules) do
|
44
|
+
require_relative 'config'
|
45
|
+
Config
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# No need to go further if librarian-puppet is already installed
|
4
|
+
$(which librarian-puppet > /dev/null 2>&1)
|
5
|
+
|
6
|
+
if [ "$?" -eq '0' ]; then
|
7
|
+
exit 0
|
8
|
+
fi
|
9
|
+
|
10
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
11
|
+
# Library
|
12
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
13
|
+
|
14
|
+
# Installs puppet-librarian
|
15
|
+
InstallLibrarianPuppet () {
|
16
|
+
echo 'Attempting to install librarian-puppet'
|
17
|
+
|
18
|
+
gem install librarian-puppet --version "$version"
|
19
|
+
|
20
|
+
if [ "$?" -ne '0' ]; then
|
21
|
+
echo 'Failed to install librarian-puppet'
|
22
|
+
exit $?
|
23
|
+
fi
|
24
|
+
}
|
25
|
+
|
26
|
+
# Installs ruby-dev
|
27
|
+
InstallRubyDev () {
|
28
|
+
# ensure it is not already installed
|
29
|
+
$(dpkg -s ruby-dev > /dev/null 2>&1)
|
30
|
+
|
31
|
+
if [ "$?" -eq '0' ]; then
|
32
|
+
return
|
33
|
+
fi
|
34
|
+
|
35
|
+
# try to install it with the appropriate package manager
|
36
|
+
echo 'Attempting to install Ruby devkit...'
|
37
|
+
|
38
|
+
if [ "${FOUND_YUM}" -eq '0' ]; then
|
39
|
+
yum -q -y makecache
|
40
|
+
yum -q -y install ruby-dev
|
41
|
+
elif [ "${FOUND_APT}" -eq '0' ]; then
|
42
|
+
apt-get -q -y install ruby-dev
|
43
|
+
fi
|
44
|
+
|
45
|
+
if [ "$?" -ne '0' ]; then
|
46
|
+
echo 'Failed to install Ruby devkit...'
|
47
|
+
exit $?
|
48
|
+
fi
|
49
|
+
}
|
50
|
+
|
51
|
+
#Installs git
|
52
|
+
InstallGit () {
|
53
|
+
# ensure git is not already installed
|
54
|
+
$(which git > /dev/null 2>&1)
|
55
|
+
|
56
|
+
if [ "$?" -eq '0' ]; then
|
57
|
+
return
|
58
|
+
fi
|
59
|
+
|
60
|
+
# try to install git with the appropriate package manager
|
61
|
+
echo 'Attempting to install Git...'
|
62
|
+
|
63
|
+
if [ "${FOUND_YUM}" -eq '0' ]; then
|
64
|
+
yum -q -y makecache
|
65
|
+
yum -q -y install git
|
66
|
+
elif [ "${FOUND_APT}" -eq '0' ]; then
|
67
|
+
apt-get -q -y install git
|
68
|
+
fi
|
69
|
+
|
70
|
+
if [ "$?" -ne '0' ]; then
|
71
|
+
echo 'Failed to install Git...'
|
72
|
+
exit $?
|
73
|
+
fi
|
74
|
+
}
|
75
|
+
|
76
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
77
|
+
# Script
|
78
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
79
|
+
|
80
|
+
# Ensure we have one supported package manager, up to date
|
81
|
+
$(which apt-get > /dev/null 2>&1)
|
82
|
+
FOUND_APT=$?
|
83
|
+
|
84
|
+
$(which yum > /dev/null 2>&1)
|
85
|
+
FOUND_YUM=$?
|
86
|
+
|
87
|
+
if [ "${FOUND_YUM}" -ne '0' -a "${FOUND_APT}" -ne '0' ]; then
|
88
|
+
echo 'No supported package installer available. You may need to install git and librarian-puppet manually.'
|
89
|
+
exit 1
|
90
|
+
fi
|
91
|
+
|
92
|
+
if [ "${FOUND_APT}" -eq '0' ]; then
|
93
|
+
apt-get -q -y update
|
94
|
+
fi
|
95
|
+
|
96
|
+
# Collect the parameters
|
97
|
+
while getopts :v: opt; do
|
98
|
+
case "$opt" in
|
99
|
+
v) version="$OPTARG"
|
100
|
+
;;
|
101
|
+
\?) echo "Unknown option -$OPTARG. Usage: $0 -v version" >&2
|
102
|
+
;;
|
103
|
+
esac
|
104
|
+
done
|
105
|
+
|
106
|
+
# Install the appropriate packages
|
107
|
+
InstallGit
|
108
|
+
InstallRubyDev
|
109
|
+
InstallLibrarianPuppet
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-puppet-modules/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'vagrant-puppet-modules'
|
8
|
+
spec.version = VagrantPlugins::PuppetModules::VERSION
|
9
|
+
spec.authors = ['Anis Safine']
|
10
|
+
spec.email = ['anis@poensis.fr']
|
11
|
+
spec.description = 'A Vagrant plugin that installs the appropriate Puppet modules on your guest machine, via' \
|
12
|
+
' librarian-puppet.'
|
13
|
+
spec.summary = spec.description
|
14
|
+
spec.homepage = 'https://github.com/anis/vagrant-puppet-modules'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-puppet-modules
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anis Safine
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A Vagrant plugin that installs the appropriate Puppet modules on your
|
42
|
+
guest machine, via librarian-puppet.
|
43
|
+
email:
|
44
|
+
- anis@poensis.fr
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/vagrant-puppet-modules.rb
|
55
|
+
- lib/vagrant-puppet-modules/action/install_librarian_puppet.rb
|
56
|
+
- lib/vagrant-puppet-modules/action/install_puppet_modules.rb
|
57
|
+
- lib/vagrant-puppet-modules/config.rb
|
58
|
+
- lib/vagrant-puppet-modules/plugin.rb
|
59
|
+
- lib/vagrant-puppet-modules/version.rb
|
60
|
+
- shell/librarian_puppet_install.sh
|
61
|
+
- vagrant-puppet-modules.gemspec
|
62
|
+
homepage: https://github.com/anis/vagrant-puppet-modules
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.2.2
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: A Vagrant plugin that installs the appropriate Puppet modules on your guest
|
86
|
+
machine, via librarian-puppet.
|
87
|
+
test_files: []
|