opswalrus 1.0.19 → 1.0.21

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
  SHA256:
3
- metadata.gz: c0ff652415da76b83b423422356b87d8745396a130589a5b6eca43c29f5ef5ca
4
- data.tar.gz: 6d61f7b4e9f12887ee5477331090ef91a6d080f39fc5aaf748ea613b5f6a228f
3
+ metadata.gz: dc53d0a80c9c27e8557d84f41f215c9c03182286997f4aa78e9ff4e353231807
4
+ data.tar.gz: 42ef62ca0ba2e8fb90a66e764a477da9d798b95c65ff7a0ae432a1e8ccb02609
5
5
  SHA512:
6
- metadata.gz: cbbb9c27cb16fdc2d57aa0d17ee359133a3340df01de204f26c990bb0fc09cd8c3675e69ebfb8c21fc08823b2489c85012e2bcd6c1c9f6d2acb12e1ac3d22bd4
7
- data.tar.gz: 891cc95c97be369ee25c4e83fe761db15842f96f210fd1d2ab9ac73ee74fd084a5952e333cb86beb16d150a188efbf3f8bd23f3c2c9aeacdf5a572c3fa48697f
6
+ metadata.gz: 1fcb4f648d74f29991484d2c602b50972b89b5ea611891d6e69170c504f9621a5da0d63c3c3d3fb8fd670f8757029800233ce031397627281765c24d4572f2f4
7
+ data.tar.gz: 9d2bbeec8ec4606f001409253cb4d8c12f3cfca56bf5384a03bd47934aa8cb1aeb3e38c10e51c775c30f33a79e82774ec93e81178a371b2ce1f6840c81d03acb
data/Gemfile.lock CHANGED
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opswalrus (1.0.19)
4
+ opswalrus (1.0.21)
5
5
  amazing_print (~> 1.5)
6
6
  bcrypt_pbkdf (~> 1.1)
7
7
  citrus (~> 3.0)
8
8
  ed25519 (~> 1.3)
9
9
  git (~> 1.18)
10
10
  gli (~> 2.21)
11
- ougai (~> 2.0)
12
11
  pastel (~> 0.8)
13
12
  rubyzip (~> 2.3)
13
+ semantic_logger (~> 4.13)
14
14
  sshkit (~> 1.21)
15
15
  tty-editor (~> 0.7)
16
16
 
@@ -22,6 +22,7 @@ GEM
22
22
  amazing_print (1.5.0)
23
23
  bcrypt_pbkdf (1.1.0)
24
24
  citrus (3.0.2)
25
+ concurrent-ruby (1.2.2)
25
26
  diff-lcs (1.5.0)
26
27
  ed25519 (1.3.0)
27
28
  git (1.18.0)
@@ -31,9 +32,6 @@ GEM
31
32
  net-scp (4.0.0)
32
33
  net-ssh (>= 2.6.5, < 8.0.0)
33
34
  net-ssh (7.2.0)
34
- oj (3.16.0)
35
- ougai (2.0.0)
36
- oj (~> 3.10)
37
35
  pastel (0.8.0)
38
36
  tty-color (~> 0.5)
39
37
  public_suffix (5.0.3)
@@ -53,6 +51,8 @@ GEM
53
51
  rspec-support (~> 3.12.0)
54
52
  rspec-support (3.12.1)
55
53
  rubyzip (2.3.2)
54
+ semantic_logger (4.14.0)
55
+ concurrent-ruby (~> 1.0)
56
56
  sshkit (1.21.5)
57
57
  net-scp (>= 1.1.2)
58
58
  net-ssh (>= 2.8.0)
data/lib/opswalrus/app.rb CHANGED
@@ -1,12 +1,11 @@
1
- require "amazing_print"
2
1
  require "citrus"
3
2
  require "io/console"
4
3
  require "json"
5
4
  # require "logger"
6
5
  require "random/formatter"
7
- require "ougai"
8
6
  require "pastel"
9
7
  require "pathname"
8
+ require "semantic_logger"
10
9
  require "shellwords"
11
10
  require "socket"
12
11
  require "stringio"
@@ -36,9 +35,11 @@ module OpsWalrus
36
35
  attr_reader :local_hostname
37
36
 
38
37
  def initialize(pwd = Dir.pwd)
39
- @logger = Ougai::Logger.new($stdout) # Logger.new($stdout, level: Logger::INFO)
38
+ SemanticLogger.default_level = :info
39
+ # SemanticLogger.add_appender(file_name: 'development.log', formatter: :color) # Log to a file, and use the colorized formatter
40
+ SemanticLogger.add_appender(io: $stdout, formatter: :color) # Log errors and above to standard error:
41
+ @logger = SemanticLogger[OpsWalrus] # Logger.new($stdout, level: Logger::INFO)
40
42
  @logger.level = :info # , :trace or 'trace'
41
- @logger.formatter = Ougai::Formatters::Readable.new
42
43
 
43
44
  # @logger.warn Style.yellow("warn"), foo: "bar", baz: {qux: "quux"}
44
45
  # @logger.info Style.yellow("info"), foo: "bar", baz: {qux: "quux"}
@@ -110,28 +111,16 @@ module OpsWalrus
110
111
  end
111
112
 
112
113
  # log_level = :fatal, :error, :warn, :info, :debug, :trace
113
- # irb(main):018:0> Ougai::Logger::TRACE
114
- # => -1
115
- # irb(main):019:0> Ougai::Logger::DEBUG
116
- # => 0
117
- # irb(main):020:0> Ougai::Logger::INFO
118
- # => 1
119
- # irb(main):021:0> Ougai::Logger::WARN
120
- # => 2
121
- # irb(main):022:0> Ougai::Logger::ERROR
122
- # => 3
123
- # irb(main):023:0> Ougai::Logger::FATAL
124
- # => 4
125
114
  def set_log_level(log_level)
126
115
  @logger.level = log_level
127
116
  end
128
117
 
129
118
  def verbose?
130
- @logger.level <= 1
119
+ [:info, :debug, :trace].include? @logger.level
131
120
  end
132
121
 
133
122
  def debug?
134
- @logger.level <= 0
123
+ [:debug, :trace].include? @logger.level
135
124
  end
136
125
 
137
126
  def fatal(*args)
@@ -199,6 +188,15 @@ module OpsWalrus
199
188
  @params = json_hash # @params returns a Hash or nil
200
189
  end
201
190
 
191
+ def bootstrap()
192
+ set_pwd(__FILE__.to_pathname.dirname)
193
+ bootstrap_ops_file = OpsFile.new(self, __FILE__.to_pathname.dirname.join("bootstrap.ops"))
194
+ op = OperationRunner.new(self, bootstrap_ops_file)
195
+ result = op.run([], params_json_hash: @params)
196
+ info "Bootstrap results:"
197
+ info result
198
+ end
199
+
202
200
  # args is of the form ["github.com/davidkellis/my-package/sub-package1", "operation1", "arg1:val1", "arg2:val2", "arg3:val3"]
203
201
  # if the first argument is the path to a .ops file, then treat it as a local path, and add the containing package
204
202
  # to the load path
@@ -0,0 +1,4 @@
1
+ ssh_noprep in: :sequence do
2
+ puts "Bootstrapping #{to_s} (alias=#{self.alias})"
3
+ _bootstrap_host()
4
+ end
@@ -38,8 +38,8 @@ if echo $OS | grep -q 'ubuntu'; then
38
38
  sudo needrestart -q -r a
39
39
  sudo needrestart -q -r a
40
40
  elif echo $OS | grep -q 'fedora'; then
41
- sudo yum groupinstall -y 'Development Tools'
42
- sudo yum install -y procps-ng curl file git
41
+ sudo dnf groupinstall -y 'Development Tools'
42
+ sudo dnf -yq install procps-ng curl file git
43
43
  elif echo $OS | grep -q 'arch'; then
44
44
  sudo pacman -Syu --noconfirm base-devel procps-ng curl file git
45
45
  else
data/lib/opswalrus/cli.rb CHANGED
@@ -49,8 +49,8 @@ module OpsWalrus
49
49
  long_desc 'Report on the host inventory'
50
50
  command :inventory do |c|
51
51
  c.action do |global_options, options, args|
52
- hosts = global_options[:hosts]
53
- tags = global_options[:tags]
52
+ hosts = global_options[:hosts] || []
53
+ tags = global_options[:tags] || []
54
54
 
55
55
  log_level = global_options[:debug] && :trace || global_options[:verbose] && :debug || :info
56
56
  $app.set_log_level(log_level)
@@ -59,6 +59,31 @@ module OpsWalrus
59
59
  end
60
60
  end
61
61
 
62
+ desc 'Bootstrap a set of hosts to run opswalrus'
63
+ long_desc 'Bootstrap a set of hotss to run opswalrus: install dependencies, ruby, opswalrus gem'
64
+ command :bootstrap do |c|
65
+ # dry run
66
+ c.switch :noop, desc: "Perform a dry run"
67
+ c.switch :dryrun, desc: "Perform a dry run"
68
+ c.switch :dry_run, desc: "Perform a dry run"
69
+
70
+ c.action do |global_options, options, args|
71
+ log_level = global_options[:debug] && :trace || global_options[:verbose] && :debug || :info
72
+ $app.set_log_level(log_level)
73
+
74
+ hosts = global_options[:hosts] || []
75
+ tags = global_options[:tags] || []
76
+
77
+ $app.set_inventory_hosts(hosts)
78
+ $app.set_inventory_tags(tags)
79
+
80
+ dry_run = [:noop, :dryrun, :dry_run].any? {|sym| global_options[sym] || options[sym] }
81
+ $app.dry_run! if dry_run
82
+
83
+ $app.bootstrap()
84
+ end
85
+ end
86
+
62
87
  desc 'Run an operation from a package'
63
88
  long_desc 'Run the specified operation found within the specified package'
64
89
  arg_name 'args', :multiple
@@ -71,12 +71,48 @@ module OpsWalrus
71
71
  @runtime_env = runtime_env
72
72
  end
73
73
 
74
- # the subclasses of this class will define methods that handle method dispatch via HostProxyOpsFileInvocationBuilder objects
74
+ # the subclasses of this class will define methods that handle method dispatch via RemoteImportInvocationContext objects
75
75
 
76
76
  def to_s
77
77
  @_host.to_s
78
78
  end
79
79
 
80
+ def _bootstrap_host
81
+ # copy over bootstrap shell script
82
+ # io = StringIO.new(bootstrap_shell_script)
83
+ io = File.open(__FILE__.to_pathname.dirname.join("bootstrap.sh"))
84
+ upload_success = @_host.upload(io, "tmpopsbootstrap.sh")
85
+ io.close
86
+ raise Error, "Unable to upload bootstrap shell script to remote host #{to_s} (alias=#{self.alias})" unless upload_success
87
+ @_host.execute(:chmod, "755", "tmpopsbootstrap.sh")
88
+ @_host.execute(:sh, "tmpopsbootstrap.sh")
89
+ @_host.execute(:rm, "-f", "tmpopsbootstrap.sh")
90
+ end
91
+
92
+ def _zip_copy_and_run_ops_bundle(local_host, block)
93
+ # copy over ops bundle zip file
94
+ zip_bundle_path = @runtime_env.zip_bundle_path
95
+ upload_success = @_host.upload(zip_bundle_path, "tmpops.zip")
96
+ raise Error, "Unable to upload ops bundle to remote host" unless upload_success
97
+
98
+ stdout, _stderr, exit_status = @_host.run_ops(:bundle, "unzip tmpops.zip", in_bundle_root_dir: false)
99
+ raise Error, "Unable to unzip ops bundle on remote host" unless exit_status == 0
100
+ tmp_bundle_root_dir = stdout.strip
101
+ @_host.set_ssh_session_tmp_bundle_root_dir(tmp_bundle_root_dir)
102
+
103
+ # we run the block in the context of the host proxy object, s.t. `self` within the block evaluates to the host proxy object
104
+ retval = instance_exec(local_host, &block) # local_host is passed as the argument to the block
105
+
106
+ # todo: cleanup
107
+ if tmp_bundle_root_dir =~ /tmp/ # sanity check the temp path before we blow away something we don't intend
108
+ @_host.execute(:rm, "-rf", "tmpops.zip", tmp_bundle_root_dir)
109
+ else
110
+ @_host.execute(:rm, "-rf", "tmpops.zip")
111
+ end
112
+
113
+ retval
114
+ end
115
+
80
116
  def method_missing(name, ...)
81
117
  @_host.send(name, ...)
82
118
  end
@@ -52,6 +52,55 @@ module OpsWalrus
52
52
  # SCRIPT
53
53
 
54
54
  module OpsFileScriptDSL
55
+ def ssh_noprep(*args, **kwargs, &block)
56
+ runtime_env = @runtime_env
57
+
58
+ hosts = inventory(*args, **kwargs).map {|host| host_proxy_class.new(runtime_env, host) }
59
+ sshkit_hosts = hosts.map(&:sshkit_host)
60
+ sshkit_host_to_ops_host_map = sshkit_hosts.zip(hosts).to_h
61
+ local_host = self
62
+ # on sshkit_hosts do |sshkit_host|
63
+ SSHKit::Coordinator.new(sshkit_hosts).each(in: kwargs[:in] || :parallel) do |sshkit_host|
64
+ # in this context, self is an instance of one of the subclasses of SSHKit::Backend::Abstract, e.g. SSHKit::Backend::Netssh
65
+ host = sshkit_host_to_ops_host_map[sshkit_host]
66
+
67
+ begin
68
+ host.set_runtime_env(runtime_env)
69
+ host.set_ssh_session_connection(self) # self is an instance of one of the subclasses of SSHKit::Backend::Abstract, e.g. SSHKit::Backend::Netssh
70
+
71
+ # we run the block in the context of the host proxy object, s.t. `self` within the block evaluates to the host proxy object
72
+ retval = host.instance_exec(local_host, &block) # local_host is passed as the argument to the block
73
+
74
+ retval
75
+ rescue SSHKit::Command::Failed => e
76
+ puts "[!] Command failed:"
77
+ puts e.message
78
+ rescue Net::SSH::ConnectionTimeout
79
+ puts "[!] The host '#{host}' not alive!"
80
+ rescue Net::SSH::Timeout
81
+ puts "[!] The host '#{host}' disconnected/timeouted unexpectedly!"
82
+ rescue Errno::ECONNREFUSED
83
+ puts "[!] Incorrect port #{port} for #{host}"
84
+ rescue Net::SSH::HostKeyMismatch => e
85
+ puts "[!] The host fingerprint does not match the last observed fingerprint for #{host}"
86
+ puts e.message
87
+ puts "You might try `ssh-keygen -f ~/.ssh/known_hosts -R \"#{host}\"`"
88
+ rescue Net::SSH::AuthenticationFailed
89
+ puts "Wrong Password: #{host} | #{user}:#{password}"
90
+ rescue Net::SSH::Authentication::DisallowedMethod
91
+ puts "[!] The host '#{host}' doesn't accept password authentication method."
92
+ rescue Errno::EHOSTUNREACH => e
93
+ puts "[!] The host '#{host}' is unreachable"
94
+ rescue => e
95
+ puts e.class
96
+ puts e.message
97
+ puts e.backtrace.join("\n")
98
+ ensure
99
+ host.clear_ssh_session
100
+ end
101
+ end
102
+ end
103
+
55
104
  def ssh(*args, **kwargs, &block)
56
105
  runtime_env = @runtime_env
57
106
 
@@ -62,46 +111,15 @@ module OpsWalrus
62
111
  # bootstrap_shell_script = BootstrapLinuxHostShellScript
63
112
  # on sshkit_hosts do |sshkit_host|
64
113
  SSHKit::Coordinator.new(sshkit_hosts).each(in: kwargs[:in] || :parallel) do |sshkit_host|
65
-
66
114
  # in this context, self is an instance of one of the subclasses of SSHKit::Backend::Abstract, e.g. SSHKit::Backend::Netssh
67
-
68
115
  host = sshkit_host_to_ops_host_map[sshkit_host]
69
- # puts "#{host.alias} / #{host}:"
70
116
 
71
117
  begin
72
118
  host.set_runtime_env(runtime_env)
73
119
  host.set_ssh_session_connection(self) # self is an instance of one of the subclasses of SSHKit::Backend::Abstract, e.g. SSHKit::Backend::Netssh
74
120
 
75
- # copy over bootstrap shell script
76
- # io = StringIO.new(bootstrap_shell_script)
77
- io = File.open(__FILE__.to_pathname.dirname.join("bootstrap.sh"))
78
- upload_success = host.upload(io, "tmpopsbootstrap.sh")
79
- io.close
80
- raise Error, "Unable to upload bootstrap shell script to remote host" unless upload_success
81
- host.execute(:chmod, "755", "tmpopsbootstrap.sh")
82
- host.execute(:sh, "tmpopsbootstrap.sh")
83
-
84
- # copy over ops bundle zip file
85
- zip_bundle_path = runtime_env.zip_bundle_path
86
- upload_success = host.upload(zip_bundle_path, "tmpops.zip")
87
- raise Error, "Unable to upload ops bundle to remote host" unless upload_success
88
-
89
- stdout, stderr, exit_status = host.run_ops(:bundle, "unzip tmpops.zip", in_bundle_root_dir: false)
90
- raise Error, "Unable to unzip ops bundle on remote host" unless exit_status == 0
91
- tmp_bundle_root_dir = stdout.strip
92
- host.set_ssh_session_tmp_bundle_root_dir(tmp_bundle_root_dir)
93
-
94
- # we run the block in the context of the host, s.t. `self` within the block evaluates to `host`
95
- retval = host.instance_exec(local_host, &block) # host is passed as the argument to the block
96
-
97
- # puts retval.inspect
98
-
99
- # todo: cleanup
100
- # if tmp_bundle_root_dir =~ /tmp/ # sanity check the temp path before we blow away something we don't intend
101
- # host.execute(:rm, "-rf", "tmpopsbootstrap.sh", "tmpops.zip", tmp_bundle_root_dir)
102
- # else
103
- # host.execute(:rm, "-rf", "tmpopsbootstrap.sh", "tmpops.zip")
104
- # end
121
+ host._bootstrap_host
122
+ retval = host._zip_copy_and_run_ops_bundle(local_host, block)
105
123
 
106
124
  retval
107
125
  rescue SSHKit::Command::Failed => e
@@ -1,3 +1,3 @@
1
1
  module OpsWalrus
2
- VERSION = "1.0.19"
2
+ VERSION = "1.0.21"
3
3
  end
data/opswalrus.gemspec CHANGED
@@ -36,9 +36,9 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "citrus", "~> 3.0"
37
37
  spec.add_dependency "gli", "~> 2.21"
38
38
  spec.add_dependency "git", "~> 1.18"
39
- spec.add_dependency "ougai", "~> 2.0"
40
39
  spec.add_dependency "pastel", "~> 0.8"
41
40
  spec.add_dependency "rubyzip", "~> 2.3"
41
+ spec.add_dependency "semantic_logger", "~> 4.13"
42
42
  spec.add_dependency "tty-editor", "~> 0.7"
43
43
 
44
44
  spec.add_dependency "bcrypt_pbkdf", "~> 1.1"
@@ -0,0 +1,86 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure("2") do |config|
9
+ # The most common configuration options are documented and commented below.
10
+ # For a complete reference, please see the online documentation at
11
+ # https://docs.vagrantup.com.
12
+
13
+ # Every Vagrant development environment requires a box. You can search for
14
+ # boxes at https://vagrantcloud.com/search.
15
+ config.vm.box = "generic/arch"
16
+
17
+ # Disable automatic box update checking. If you disable this, then
18
+ # boxes will only be checked for updates when the user runs
19
+ # `vagrant box outdated`. This is not recommended.
20
+ # config.vm.box_check_update = false
21
+
22
+ # Create a forwarded port mapping which allows access to a specific port
23
+ # within the machine from a port on the host machine. In the example below,
24
+ # accessing "localhost:8080" will access port 80 on the guest machine.
25
+ # NOTE: This will enable public access to the opened port
26
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
27
+
28
+ # Create a forwarded port mapping which allows access to a specific port
29
+ # within the machine from a port on the host machine and only allow access
30
+ # via 127.0.0.1 to disable public access
31
+ # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
32
+
33
+ # Create a private network, which allows host-only access to the machine
34
+ # using a specific IP.
35
+ config.vm.network "private_network", ip: "192.168.56.12"
36
+
37
+ # config.ssh.insert_key = false
38
+ config.ssh.forward_agent = true
39
+
40
+
41
+ # Create a public network, which generally matched to bridged network.
42
+ # Bridged networks make the machine appear as another physical device on
43
+ # your network.
44
+ # config.vm.network "public_network"
45
+
46
+ # Share an additional folder to the guest VM. The first argument is
47
+ # the path on the host to the actual folder. The second argument is
48
+ # the path on the guest to mount the folder. And the optional third
49
+ # argument is a set of non-required options.
50
+ # config.vm.synced_folder "../data", "/vagrant_data"
51
+
52
+ # Disable the default share of the current code directory. Doing this
53
+ # provides improved isolation between the vagrant box and your host
54
+ # by making sure your Vagrantfile isn't accessable to the vagrant box.
55
+ # If you use this you may want to enable additional shared subfolders as
56
+ # shown above.
57
+ # config.vm.synced_folder ".", "/vagrant", disabled: true
58
+
59
+ # Provider-specific configuration so you can fine-tune various
60
+ # backing providers for Vagrant. These expose provider-specific options.
61
+ # Example for VirtualBox:
62
+ #
63
+ # config.vm.provider "virtualbox" do |vb|
64
+ # # Display the VirtualBox GUI when booting the machine
65
+ # vb.gui = true
66
+ #
67
+ # # Customize the amount of memory on the VM:
68
+ # vb.memory = "1024"
69
+ # end
70
+ #
71
+ # View the documentation for the provider you are using for more
72
+ # information on available options.
73
+
74
+ # Enable provisioning with a shell script. Additional provisioners such as
75
+ # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
76
+ # documentation for more information about their specific syntax and use.
77
+ config.vm.provision "shell", inline: <<-SHELL
78
+ sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
79
+ sudo systemctl restart sshd
80
+
81
+ # change vagrant user to require sudo password
82
+ sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD: ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
83
+
84
+ # sudo sh -c 'echo root:foo | chpasswd'
85
+ SHELL
86
+ end
@@ -0,0 +1,52 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+ # The most common configuration options are documented and commented below.
6
+ # For a complete reference, please see the online documentation at
7
+ # https://docs.vagrantup.com.
8
+
9
+ # Every Vagrant development environment requires a box. You can search for
10
+ # boxes at https://vagrantcloud.com/search.
11
+ config.vm.box = "fedora/38-cloud-base"
12
+
13
+ # Create a private network, which allows host-only access to the machine
14
+ # using a specific IP.
15
+ config.vm.network "private_network", ip: "192.168.56.11"
16
+
17
+ # config.ssh.insert_key = false
18
+ config.ssh.forward_agent = true
19
+
20
+ config.vm.provider "virtualbox" do |vb|
21
+ # # Display the VirtualBox GUI when booting the machine
22
+ # vb.gui = true
23
+ #
24
+ # # Customize the amount of memory on the VM:
25
+ vb.memory = "1024"
26
+ end
27
+
28
+ # Enable provisioning with a shell script. Additional provisioners such as
29
+ # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
30
+ # documentation for more information about their specific syntax and use.
31
+ config.vm.provision "shell", inline: <<-SHELL
32
+ sudo dnf install -yq NetworkManager-initscripts-ifcfg-rh
33
+
34
+ # this migrates the old network management config to the new style
35
+ sudo nmcli connection migrate
36
+
37
+ # # per https://github.com/hashicorp/vagrant/issues/12762#issuecomment-1535957837 :
38
+ # sudo nmcli conn modify 'Wired connection 2' ipv4.addresses $(cat /etc/sysconfig/network-scripts/ifcfg-eth1 | grep IPADDR | cut -d "=" -f2)
39
+ # sudo nmcli conn modify 'Wired connection 2' ipv4.method manual
40
+ # sudo systemctl restart NetworkManager
41
+
42
+ sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
43
+ sudo systemctl restart sshd
44
+
45
+ nohup sudo -b bash -c 'sleep 3; reboot' &>/dev/null;
46
+
47
+ # change vagrant user to require sudo password
48
+ sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD: ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant-nopasswd
49
+
50
+ # sudo sh -c 'echo root:foo | chpasswd'
51
+ SHELL
52
+ end
@@ -0,0 +1,32 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+ # The most common configuration options are documented and commented below.
6
+ # For a complete reference, please see the online documentation at
7
+ # https://docs.vagrantup.com.
8
+
9
+ # Every Vagrant development environment requires a box. You can search for
10
+ # boxes at https://vagrantcloud.com/search.
11
+ config.vm.box = "ubuntu/jammy64"
12
+
13
+ # Create a private network, which allows host-only access to the machine
14
+ # using a specific IP.
15
+ config.vm.network "private_network", ip: "192.168.56.10"
16
+
17
+ # config.ssh.insert_key = false
18
+ config.ssh.forward_agent = true
19
+
20
+ # Enable provisioning with a shell script. Additional provisioners such as
21
+ # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
22
+ # documentation for more information about their specific syntax and use.
23
+ config.vm.provision "shell", inline: <<-SHELL
24
+ sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
25
+ sudo systemctl restart sshd
26
+
27
+ # change vagrant user to require sudo password
28
+ sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD:ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
29
+
30
+ # sudo sh -c 'echo root:foo | chpasswd'
31
+ SHELL
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opswalrus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.19
4
+ version: 1.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis
@@ -67,47 +67,47 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.18'
69
69
  - !ruby/object:Gem::Dependency
70
- name: ougai
70
+ name: pastel
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: '0.8'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '0.8'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pastel
84
+ name: rubyzip
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.8'
89
+ version: '2.3'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.8'
96
+ version: '2.3'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubyzip
98
+ name: semantic_logger
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.3'
103
+ version: '4.13'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.3'
110
+ version: '4.13'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: tty-editor
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -185,6 +185,7 @@ files:
185
185
  - exe/ops
186
186
  - lib/opswalrus.rb
187
187
  - lib/opswalrus/app.rb
188
+ - lib/opswalrus/bootstrap.ops
188
189
  - lib/opswalrus/bootstrap.sh
189
190
  - lib/opswalrus/bundler.rb
190
191
  - lib/opswalrus/cli.rb
@@ -210,6 +211,9 @@ files:
210
211
  - lib/opswalrus/zip.rb
211
212
  - opswalrus.gemspec
212
213
  - sig/opswalrus.rbs
214
+ - vms/web-arch/Vagrantfile
215
+ - vms/web-fedora/Vagrantfile
216
+ - vms/web-ubuntu/Vagrantfile
213
217
  homepage: https://github.com/opswalrus/opswalrus
214
218
  licenses:
215
219
  - EPL-2.0