vagrant-lfstacks 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4079054be88e06ce0a5cbd1b0fec91738e1991d0
4
- data.tar.gz: 2c16a3afe031b4fb44c0396579ba383b8d439be0
3
+ metadata.gz: f95597ff7c38a0522acbbf46b291ebb17e9053e6
4
+ data.tar.gz: 4ccb4319c32f4e0e3f7e3ee4fd2ed7b5f51cc46b
5
5
  SHA512:
6
- metadata.gz: b5eb4b5875f71fe041da44fce6901f785a8e12bf0d1f45563af40fc3d12ed2014b64889e2cbbd45f5484b902b28b1191beefd21d3ed627bdb5314e59d846c768
7
- data.tar.gz: 7e18592636adb4e12c7ba761d5d7b0482b72f540e1d4e94f900f0fe0845e6d9c50f451d2819ec4cb125e07b9fac04809ab69623510f404c6c5e4f5c4da4f1d60
6
+ metadata.gz: 510c98fe2af6fdb2f0d8c59aa837283c22c44178340018c128d05147dbb0ab4a4cf24203d58125cc5f8b5d58f86554e2a10b7cc04c44fc133b6e741bfda0bccc
7
+ data.tar.gz: 9a9fc870d7c0c89f48de5e52323d0be9c018f5b401dba07dc14cce3d07c144db67c3cfb8dbcbba6b6888a9f09b15f02730429d880136b709fd743be5acc9f3f3
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'aws-s3', :require => 'aws/s3'
4
4
  gem 'vagrant-dns'
5
+ gem 'vagrant-cachier'
5
6
 
6
7
 
7
8
  # Specify your gem's dependencies in lfstacks.gemspec
@@ -11,10 +11,13 @@ require 'vagrant-lfstacks'
11
11
 
12
12
  require 'yaml'
13
13
  require 'pp'
14
+ require 'erb'
14
15
 
15
16
  # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
16
17
  VAGRANTFILE_API_VERSION = "2"
17
18
 
19
+ # NK Global config hash. When creating a new key for overrides, YOU MUST PROVIDE A DEFAULT HERE!
20
+
18
21
  global_config = {
19
22
  :tld => 'localdev.livefyre.com',
20
23
  :synced_folders => [
@@ -23,17 +26,22 @@ global_config = {
23
26
  ["#{ENV['HOME']}/dev/lfconfig", '/opt/lfconfig'],
24
27
  ],
25
28
  :cache => true,
26
- :vb_mem => '1024',
27
- :vb_cpus => '8',
29
+ :vb_mem => '512',
30
+ :vb_cpus => '1',
28
31
  :vbg_auto_update => true,
29
32
  :vb_gui => false,
33
+ :userdata_template_path => "#{ENV['HOME']}/dev/lfconfig/ops_tools/lfstacks/lfuserdata.sh.erb",
34
+ :userdata_provision => true
30
35
  }
31
36
 
37
+
38
+
39
+
32
40
  # NK here we grab any overrides
33
41
 
34
- if File.exists?('./config.d/global_overrides.yaml')
35
- overrides = YAML.load_file('./config.d/global_overrides.yaml')
36
- global_config.update(overrides)
42
+ if File.exists?('./config.d/global_overrides.yml')
43
+ overrides = YAML.load_file('./config.d/global_overrides.yml')
44
+ global_config.update(overrides) if overrides
37
45
  end
38
46
 
39
47
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@@ -48,6 +56,18 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
48
56
  puppet_config.vm.network "private_network", ip: guest[:ip]
49
57
  #puppet_config.vm.customize ["setextradata", :id, cnames]
50
58
  puppet_config.vm.host_name = "#{guest[:hostname]}.#{guest[:domain]}"
59
+
60
+ # USERDATA provisioning!
61
+ if global_config[:userdata_provision]
62
+ # NK **** This follows our nodes.pp convention, see Andrew on why he wants to follow it.
63
+ role = /^(\D+)(\d*)$/.match(guest[:hostname])[0]
64
+ @hostname = "#{guest[:hostname]}.#{guest[:domain]}"
65
+ template = File.read(global_config[:userdata_template_path])
66
+ @userdata_vagrant = true
67
+ user_data = ERB.new(template).result(binding)
68
+ puppet_config.vm.provision 'shell', inline: user_data
69
+ end
70
+
51
71
  end
52
72
  end
53
73
  end
@@ -59,8 +79,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
59
79
  config.vm.synced_folder(*synced_folder)
60
80
  end
61
81
 
62
- # config.cache.auto_detect = true if global_config[:cache]
63
- # config.vbguest.auto_update = false unless global_config[:vbg_auto_update]
82
+
83
+
84
+
85
+ # short term fix for vagrant dns issue....see https://github.com/BerlinVagrant/vagrant-dns/issues/27
86
+ # Will be fixed in Vagrant 1.5.0, see https://github.com/mitchellh/vagrant/issues/2756
87
+ VagrantDNS::Config.auto_run = false
64
88
 
65
89
 
66
90
 
@@ -21,13 +21,13 @@ class ReimageCommand < Vagrant.plugin(2, :command)
21
21
  end
22
22
 
23
23
  with_target_vms("puppet") do |machine|
24
- @env.ui.info "Removing #{machine.name}'s cert on puppet master"
24
+ @env.ui.info "Removing #{machine.name}'s cert on puppet master", :color => :green
25
25
  argv.each do |target|
26
- ssh_cmd machine, "puppet cert clean #{target}.localdev.livefyre.com || true"
26
+ ssh_cmd(machine, "puppet cert clean #{target}.localdev.livefyre.com", {:error_check => false})
27
27
  end
28
28
  end
29
29
  with_target_vms(argv) do |machine|
30
- @env.ui.info "Destroying #{machine.name}"
30
+ @env.ui.info "Destroying #{machine.name}", :color => :green
31
31
  machine.action(:destroy, :force_confirm_destroy => true)
32
32
  machine.action(:up)
33
33
 
@@ -35,13 +35,13 @@ class ReimageCommand < Vagrant.plugin(2, :command)
35
35
  # initialization.
36
36
  # this is the issue on REHL:
37
37
  # https://github.com/mitchellh/vagrant/pull/1577
38
- cycle_iface machine, "eth1"
39
- ssh_cmd machine, "rm -rf /var/lib/puppet/"
40
- ssh_cmd machine, "/puppet_configs/scripts/ensure_hostname #{machine.name}.localdev.livefyre.com"
41
- @env.ui.info "Installing puppet for #{machine.name}"
42
- ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_installed client"
43
- @env.ui.info "Running puppet on#{machine.name}"
44
- ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_converged -w"
38
+ # cycle_iface machine, "eth1"
39
+ # ssh_cmd machine, "rm -rf /var/lib/puppet/"
40
+ # ssh_cmd machine, "/puppet_configs/scripts/ensure_hostname #{machine.name}.localdev.livefyre.com"
41
+ # @env.ui.info "Installing puppet for #{machine.name}"
42
+ # ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_installed client"
43
+ # @env.ui.info "Running puppet on#{machine.name}"
44
+ # ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_converged -w"
45
45
  end
46
46
  end
47
47
  end
@@ -9,7 +9,7 @@ class RemasterCommand < Vagrant.plugin(2, :command)
9
9
  end
10
10
 
11
11
  def self.synopsis
12
- "Sets up a new puppet master while recycling the SSL keys on a puppetdb"
12
+ "DOES NOT WORK YET -- Sets up a new puppet master while recycling the SSL keys on a puppetdb"
13
13
  end
14
14
 
15
15
  def execute
@@ -19,7 +19,7 @@ class RepuppetCommand < Vagrant.plugin(2, :command)
19
19
  # Destroy all the puppet infrastructure #
20
20
  #########################################
21
21
  with_target_vms('puppetdb') do |machine|
22
- @env.ui.info "Destroying puppet db"
22
+ @env.ui.info "Destroying puppet db", :color => :green
23
23
  machine.action(:destroy, :force_confirm_destroy=>true)
24
24
  end
25
25
  with_target_vms('puppet') do |machine|
@@ -31,7 +31,7 @@ class RepuppetCommand < Vagrant.plugin(2, :command)
31
31
  # Rebuild the puppet master in no-db mode #
32
32
  ###########################################
33
33
  with_target_vms('puppet') do |machine|
34
- @env.ui.info "rebuilding puppet"
34
+ @env.ui.info "rebuilding puppet", :color => :green
35
35
  machine.action(:up)
36
36
 
37
37
  # this is hack to get around a bug in the vagrant
@@ -40,15 +40,15 @@ class RepuppetCommand < Vagrant.plugin(2, :command)
40
40
  # https://github.com/mitchellh/vagrant/pull/1577
41
41
  cycle_iface machine, "eth1"
42
42
 
43
- @env.ui.info "Bootstrapping puppet master"
44
- ssh_cmd machine, "/puppet_configs/scripts/puppet_master_setup.sh puppet.localdev.livefyre.com"
43
+ @env.ui.info "Bootstrapping puppet master", :color => :green
44
+ # ssh_cmd machine, "/opt/lfuserdata/puppet_master_setup.sh puppet.localdev.livefyre.com"
45
45
  end
46
46
 
47
47
  ########################
48
48
  # Rebuild the puppetdb #
49
49
  ########################
50
50
  with_target_vms('puppetdb') do |machine|
51
- @env.ui.info "rebuilding puppetdb"
51
+ @env.ui.info "rebuilding puppetdb", :color => :green
52
52
  machine.action(:up)
53
53
 
54
54
  # this is hack to get around a bug in the vagrant
@@ -57,18 +57,18 @@ class RepuppetCommand < Vagrant.plugin(2, :command)
57
57
  # https://github.com/mitchellh/vagrant/pull/1577
58
58
  cycle_iface machine, "eth1"
59
59
 
60
- @env.ui.info "Bootstrapping puppetdb"
61
- ssh_cmd machine, "/puppet_configs/scripts/puppet_db_setup.sh puppetdb.localdev.livefyre.com"
62
- @env.ui.info "Running puppet on puppet db"
63
- ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_converged -w"
60
+ # @env.ui.info "Bootstrapping puppetdb"
61
+ # ssh_cmd machine, "/opt/lfuserdata/puppet_db_setup.sh puppetdb.localdev.livefyre.com"
62
+ # @env.ui.info "Running puppet on puppet db"
63
+ # ssh_cmd machine, "/opt/lfuserdata/ensure_puppet_converged.sh -w"
64
64
  end
65
65
 
66
66
  #####################################
67
67
  # Re-enable store configs in puppet #
68
68
  #####################################
69
69
  with_target_vms('puppet') do |machine|
70
- @env.ui.info "Running puppet on puppet master"
71
- ssh_cmd machine, "/puppet_configs/scripts/ensure_puppet_converged -w"
70
+ @env.ui.info "Running puppet on puppet master", :color => :green
71
+ ssh_cmd machine, "/opt/lfuserdata/ensure_puppet_converged.sh -w"
72
72
  end
73
73
  end
74
74
  end
@@ -0,0 +1,28 @@
1
+
2
+ require "vagrant/util/ssh"
3
+
4
+ class RsshCommand < Vagrant.plugin(2, :command)
5
+
6
+ def self.synopsis
7
+ "Ssh on the secondary interface to work around network freeze"
8
+ end
9
+
10
+ def execute
11
+
12
+ argv = parse_options
13
+ return unless argv.length == 1
14
+
15
+ target_machine = argv[0]
16
+ with_target_vms(argv) do |machine|
17
+
18
+ old_info = machine.ssh_info.dup
19
+ old_info[:port] = 22
20
+ old_info[:host] = machine.config.vm.hostname
21
+ # key_path = info[:private_key_path]
22
+ # `ssh -i #{key_path} vagrant@#{machine.host_name}`
23
+ Vagrant::Util::SSH.exec(old_info)
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -1,4 +1,4 @@
1
1
  module Lfstacks
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.1"
3
3
  end
4
4
 
@@ -46,6 +46,11 @@ module Lfstacks
46
46
  BootstrapCommand
47
47
  end
48
48
 
49
+ command "rssh" do
50
+ require_relative 'commands/rssh'
51
+ RsshCommand
52
+ end
53
+
49
54
 
50
55
 
51
56
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-lfstacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navid Khalili
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,6 +69,7 @@ files:
69
69
  - lib/commands/reimage.rb
70
70
  - lib/commands/remaster.rb
71
71
  - lib/commands/repuppet.rb
72
+ - lib/commands/rssh.rb
72
73
  - lib/commands/s3box.rb
73
74
  - lib/vagrant-lfstacks.rb
74
75
  - lib/vagrant-lfstacks/utils.rb