vagrant-hiera 0.2.1 → 0.3.0
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/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/README.md +6 -2
- data/example/Gemfile +8 -0
- data/example/Vagrantfile +20 -0
- data/example/configuration/hiera.yaml +5 -0
- data/example/configuration/production.yaml +1 -0
- data/example/configuration/test.yaml +1 -0
- data/example/manifests/base.pp +3 -0
- data/example/modules/.svn/entries +40 -0
- data/example/modules/motd/manifests/init.pp +6 -0
- data/lib/vagrant-hiera/middleware/setup.rb +51 -6
- data/lib/vagrant-hiera/version.rb +1 -1
- data/locales/en.yml +8 -2
- metadata +11 -2
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.3@vagrant-hiera --create
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Vagrant::Hiera
|
2
2
|
|
3
|
-
|
3
|
+
Configures puppet-heira on your vagrant box
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
Create a [hiera.yaml](https://github.com/puppetlabs/hiera-puppet#module-user) file on your host with the datadir pointing to `/tmp/vagrant-hiera/data`
|
22
22
|
|
23
|
-
:
|
23
|
+
:yaml:
|
24
24
|
:datadir: /var/lib/hiera
|
25
25
|
|
26
26
|
Add the following to your VagrantFile:
|
@@ -33,6 +33,10 @@ And then...
|
|
33
33
|
|
34
34
|
`vagrant up`
|
35
35
|
|
36
|
+
**Note**: You will need to add/checkout [hiera-puppet]("https://github.com/puppetlabs/hiera-puppet" "Hiera Puppet") to your module path. See the following links for more information:
|
37
|
+
- https://github.com/puppetlabs/hiera-puppet#installation
|
38
|
+
- https://groups.google.com/d/msg/puppet-users/IlPq14Rsnm0/UhbbRUsqqLgJ
|
39
|
+
|
36
40
|
## Contributing
|
37
41
|
|
38
42
|
1. Fork it
|
data/example/Gemfile
ADDED
data/example/Vagrantfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant::Config.run do |config|
|
5
|
+
config.vm.box = "lucid32"
|
6
|
+
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
|
7
|
+
|
8
|
+
config.hiera.config_path = './configuration'
|
9
|
+
config.hiera.config_file = 'hiera.yaml'
|
10
|
+
config.hiera.data_path = './configuration'
|
11
|
+
|
12
|
+
config.puppetconf.updates = {'main/environment' => 'test'}
|
13
|
+
|
14
|
+
config.vm.provision :puppet do |puppet|
|
15
|
+
puppet.module_path = "./modules"
|
16
|
+
puppet.manifests_path = "./manifests"
|
17
|
+
puppet.manifest_file = "base.pp"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
motd: This is the production environment.
|
@@ -0,0 +1 @@
|
|
1
|
+
motd: This is the test environment.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
10
|
2
|
+
|
3
|
+
dir
|
4
|
+
1867
|
5
|
+
svn+ssh://svn01.colo/provisioning/trunk/ubuntu/modules/puppetdashboard
|
6
|
+
svn+ssh://svn01.colo/provisioning
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
2012-06-22T19:48:52.032815Z
|
11
|
+
1790
|
12
|
+
nhall
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
56248164-2702-44e3-8289-0c7dae5ae4d4
|
28
|
+
|
29
|
+
files
|
30
|
+
dir
|
31
|
+
|
32
|
+
tests
|
33
|
+
dir
|
34
|
+
|
35
|
+
manifests
|
36
|
+
dir
|
37
|
+
|
38
|
+
templates
|
39
|
+
dir
|
40
|
+
|
@@ -5,27 +5,69 @@ module VagrantHiera
|
|
5
5
|
def initialize(app, env)
|
6
6
|
@app = app
|
7
7
|
@env = env
|
8
|
+
@puppet_repo = 'deb http://apt.puppetlabs.com/ lucid devel main'
|
9
|
+
@puppet_version = '3.0.0-0.1rc3puppetlabs1'
|
10
|
+
@hiera_puppet_version = '1.0.0-0.1rc1-1-g3e68ff0'
|
11
|
+
@hiera_version = '1.0.0-0.1rc3'
|
8
12
|
end
|
9
13
|
|
10
14
|
def call(env)
|
11
15
|
@env = env
|
12
16
|
if @env[:vm].config.hiera.set?
|
13
|
-
|
17
|
+
add_apt_repo unless apt_repo_set?
|
18
|
+
install_puppet unless puppet_installed?
|
19
|
+
install_hiera unless hiera_installed?
|
20
|
+
install_puppet_hiera unless hiera_puppet_installed?
|
14
21
|
create_shared_folders
|
15
22
|
create_symlink_to_hiera_config
|
16
23
|
end
|
17
24
|
@app.call(env)
|
18
25
|
end
|
19
26
|
|
20
|
-
def
|
21
|
-
installed = ( @env[:vm].channel.execute("
|
27
|
+
def hiera_installed?
|
28
|
+
installed = ( @env[:vm].channel.execute("dpkg -l | grep puppet | grep #{@puppet_version}", :error_check => false) == 0 )
|
22
29
|
@env[:ui].success I18n.t('vagrant.plugins.hiera.middleware.setup.hiera_installed') if installed
|
23
30
|
installed
|
24
31
|
end
|
25
32
|
|
26
|
-
def
|
27
|
-
@env[:ui].warn I18n.t('vagrant.plugins.hiera.middleware.setup.
|
28
|
-
@env[:vm].channel.sudo("
|
33
|
+
def install_hiera
|
34
|
+
@env[:ui].warn I18n.t('vagrant.plugins.hiera.middleware.setup.install_hiera')
|
35
|
+
@env[:vm].channel.sudo("apt-get -y --force-yes install hiera=#{@hiera_version}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def apt_repo_set?
|
39
|
+
setup = ( @env[:vm].channel.execute("grep '#{@puppet_repo}' /etc/apt/sources.list", :error_check => false) == 0 )
|
40
|
+
@env[:ui].success I18n.t('vagrant.plugins.hiera.middleware.setup.apt_repo_set') if setup
|
41
|
+
setup
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_apt_repo
|
45
|
+
@env[:ui].warn I18n.t('vagrant.plugins.hiera.middleware.setup.add_apt_repo')
|
46
|
+
@env[:vm].channel.sudo("echo '#{@puppet_repo}' >> /etc/apt/sources.list")
|
47
|
+
@env[:vm].channel.sudo("apt-get -y --force-yes update")
|
48
|
+
end
|
49
|
+
|
50
|
+
def puppet_installed?
|
51
|
+
installed = ( @env[:vm].channel.execute("dpkg -l | grep puppet | grep #{@puppet_version}", :error_check => false) == 0 )
|
52
|
+
@env[:ui].success I18n.t('vagrant.plugins.hiera.middleware.setup.puppet_installed') if installed
|
53
|
+
installed
|
54
|
+
end
|
55
|
+
|
56
|
+
def install_puppet
|
57
|
+
@env[:ui].warn I18n.t('vagrant.plugins.hiera.middleware.setup.install_puppet')
|
58
|
+
@env[:vm].channel.sudo("apt-get -y --force-yes install puppet-common=#{@puppet_version}")
|
59
|
+
@env[:vm].channel.sudo("apt-get -y --force-yes install puppet=#{@puppet_version}")
|
60
|
+
end
|
61
|
+
|
62
|
+
def hiera_puppet_installed?
|
63
|
+
installed = ( @env[:vm].channel.execute("dpkg -l | grep hiera-puppet | grep #{@hiera_puppet_version}", :error_check => false) == 0 )
|
64
|
+
@env[:ui].success I18n.t('vagrant.plugins.hiera.middleware.setup.hiera_puppet_installed') if installed
|
65
|
+
installed
|
66
|
+
end
|
67
|
+
|
68
|
+
def install_hiera_puppet
|
69
|
+
@env[:ui].warn I18n.t('vagrant.plugins.hiera.middleware.setup.install_hiera_puppet')
|
70
|
+
@env[:vm].channel.sudo("apt-get -y --force-yes install hiera-puppet=#{@hiera_puppet_version}")
|
29
71
|
end
|
30
72
|
|
31
73
|
def create_shared_folders
|
@@ -40,6 +82,9 @@ module VagrantHiera
|
|
40
82
|
def create_symlink_to_hiera_config
|
41
83
|
@env[:ui].info I18n.t('vagrant.plugins.hiera.middleware.setup.installing_hiera_config')
|
42
84
|
@env[:vm].channel.sudo("mkdir -p /etc/puppet")
|
85
|
+
# This is where I think this file will end up once the official puppet v3 release is out
|
86
|
+
@env[:vm].channel.sudo("ln -fs #{@env[:vm].config.hiera.guest_config_path}/#{@env[:vm].config.hiera.config_file} /etc/hiera.yaml")
|
87
|
+
# But this is where it looks for it now
|
43
88
|
@env[:vm].channel.sudo("ln -fs #{@env[:vm].config.hiera.guest_config_path}/#{@env[:vm].config.hiera.config_file} /etc/puppet/hiera.yaml")
|
44
89
|
end
|
45
90
|
end
|
data/locales/en.yml
CHANGED
@@ -6,7 +6,13 @@ en:
|
|
6
6
|
prepare:
|
7
7
|
shared_folders: "Creating hiera shared folders metadata..."
|
8
8
|
setup:
|
9
|
-
hiera_installed: "
|
10
|
-
|
9
|
+
hiera_installed: "hiera is installed"
|
10
|
+
install_hiera: "Installing hiera"
|
11
|
+
hiera_puppet_installed: "puppet-hiera is installed"
|
12
|
+
install_hiera_puppet: "Installing puppet-hiera"
|
13
|
+
apt_repo_set: "Puppet repo exists"
|
14
|
+
add_apt_repo: "Adding puppet repo"
|
15
|
+
puppet_installed: "puppet is installed"
|
16
|
+
install_puppet: "Installing puppet"
|
11
17
|
installing_hiera_config: "Adding hiera config file"
|
12
18
|
shared_folders: "Adding hiera data folder"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hiera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: vagrant
|
@@ -34,10 +34,19 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
|
+
- .rvmrc
|
37
38
|
- Gemfile
|
38
39
|
- LICENSE
|
39
40
|
- README.md
|
40
41
|
- Rakefile
|
42
|
+
- example/Gemfile
|
43
|
+
- example/Vagrantfile
|
44
|
+
- example/configuration/hiera.yaml
|
45
|
+
- example/configuration/production.yaml
|
46
|
+
- example/configuration/test.yaml
|
47
|
+
- example/manifests/base.pp
|
48
|
+
- example/modules/.svn/entries
|
49
|
+
- example/modules/motd/manifests/init.pp
|
41
50
|
- lib/vagrant-hiera.rb
|
42
51
|
- lib/vagrant-hiera/config.rb
|
43
52
|
- lib/vagrant-hiera/middleware/prepare.rb
|