opswalrus 1.0.57 → 1.0.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/opswalrus/host.rb +2 -2
- data/lib/opswalrus/ops_file_script_dsl.rb +2 -2
- data/lib/opswalrus/version.rb +1 -1
- data/test.rb +88 -0
- data/vms/arch/Vagrantfile +27 -0
- data/vms/debian/Vagrantfile +26 -0
- data/vms/{web-fedora → fedora}/Vagrantfile +2 -2
- data/vms/freebsd/Vagrantfile +55 -0
- data/vms/rocky/Vagrantfile +55 -0
- data/vms/ubuntu/Vagrantfile +26 -0
- metadata +9 -5
- data/vms/web-arch/Vagrantfile +0 -92
- data/vms/web-ubuntu/Vagrantfile +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 561e5d52fb2898d5c93e6a1b683194ed4dccf1ba476f68be79261cd58de8afba
|
4
|
+
data.tar.gz: 0cddaa43d4fac68a82c4dd0755486a8dd25c229e46e55c9698e74e69c7eef2bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258d673028667b25f58cdf93b2d4fd82dfca0c6058687bccd3f4267d935f807c83ffc7981cbd638099186b6f93ab965a4b3d6f4bd7da2c26018e8378249bc57e
|
7
|
+
data.tar.gz: 8d234040ba815a0e83cbe15338c51cfdafee068720417ed2ce384e03bb7295a4b7b2ac68a6eca4555a52d56c2656ccc49e5a99887f013c25f4dcd7fe19f1c32c
|
data/Gemfile.lock
CHANGED
data/lib/opswalrus/host.rb
CHANGED
@@ -288,8 +288,8 @@ module OpsWalrus
|
|
288
288
|
io.puts Style.cyan(out)
|
289
289
|
io.puts Style.red(err)
|
290
290
|
elsif App.instance.info?
|
291
|
-
|
292
|
-
|
291
|
+
io.puts Style.cyan(out)
|
292
|
+
io.puts Style.red(err)
|
293
293
|
end
|
294
294
|
io.print Style.yellow(cmd_id)
|
295
295
|
io.print Style.blue(" | Finished in #{seconds} seconds with exit status ")
|
@@ -335,8 +335,8 @@ module OpsWalrus
|
|
335
335
|
io.puts Style.cyan(out)
|
336
336
|
io.puts Style.red(err)
|
337
337
|
elsif App.instance.info?
|
338
|
-
|
339
|
-
|
338
|
+
io.puts Style.cyan(out)
|
339
|
+
io.puts Style.red(err)
|
340
340
|
end
|
341
341
|
io.print Style.yellow(cmd_id)
|
342
342
|
io.print Style.blue(" | Finished in #{seconds} seconds with exit status ")
|
data/lib/opswalrus/version.rb
CHANGED
data/test.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'tty-option'
|
2
|
+
|
3
|
+
class Command
|
4
|
+
include TTY::Option
|
5
|
+
|
6
|
+
usage do
|
7
|
+
program "dock"
|
8
|
+
|
9
|
+
command "run"
|
10
|
+
|
11
|
+
desc "Run a command in a new container"
|
12
|
+
|
13
|
+
example "Set working directory (-w)",
|
14
|
+
" $ dock run -w /path/to/dir/ ubuntu pwd"
|
15
|
+
|
16
|
+
example <<~EOS
|
17
|
+
Mount volume
|
18
|
+
$ dock run -v `pwd`:`pwd` -w `pwd` ubuntu pwd
|
19
|
+
EOS
|
20
|
+
end
|
21
|
+
|
22
|
+
argument :image do
|
23
|
+
required
|
24
|
+
desc "The name of the image to use"
|
25
|
+
end
|
26
|
+
|
27
|
+
argument :command do
|
28
|
+
optional
|
29
|
+
desc "The command to run inside the image"
|
30
|
+
end
|
31
|
+
|
32
|
+
keyword :restart do
|
33
|
+
default "no"
|
34
|
+
permit %w[no on-failure always unless-stopped]
|
35
|
+
desc "Restart policy to apply when a container exits"
|
36
|
+
end
|
37
|
+
|
38
|
+
option :verbose do
|
39
|
+
arity "+"
|
40
|
+
short "-v"
|
41
|
+
desc "Verbose mode"
|
42
|
+
end
|
43
|
+
|
44
|
+
flag :detach do
|
45
|
+
short "-d"
|
46
|
+
long "--detach"
|
47
|
+
desc "Run container in background and print container ID"
|
48
|
+
end
|
49
|
+
|
50
|
+
flag :help do
|
51
|
+
short "-h"
|
52
|
+
long "--help"
|
53
|
+
desc "Print usage"
|
54
|
+
end
|
55
|
+
|
56
|
+
option :name do
|
57
|
+
required
|
58
|
+
long "--name string"
|
59
|
+
desc "Assign a name to the container"
|
60
|
+
end
|
61
|
+
|
62
|
+
option :port do
|
63
|
+
arity one_or_more
|
64
|
+
short "-p"
|
65
|
+
long "--publish list"
|
66
|
+
convert :list
|
67
|
+
desc "Publish a container's port(s) to the host"
|
68
|
+
end
|
69
|
+
|
70
|
+
def run
|
71
|
+
puts params[:verbose].inspect
|
72
|
+
if params[:help]
|
73
|
+
print help
|
74
|
+
elsif params.errors.any?
|
75
|
+
puts params.errors.summary
|
76
|
+
else
|
77
|
+
pp params.to_h
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def main
|
83
|
+
cmd = Command.new
|
84
|
+
cmd.parse
|
85
|
+
puts cmd.run
|
86
|
+
end
|
87
|
+
|
88
|
+
main
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.box = "archlinux/archlinux"
|
6
|
+
|
7
|
+
config.vm.network "private_network", ip: "192.168.56.10"
|
8
|
+
|
9
|
+
# config.ssh.insert_key = false
|
10
|
+
config.ssh.forward_agent = true
|
11
|
+
|
12
|
+
config.vm.provision "shell" do |s|
|
13
|
+
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_ops.pub").first.strip
|
14
|
+
s.inline = <<-SHELL
|
15
|
+
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
|
16
|
+
echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
|
17
|
+
|
18
|
+
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
19
|
+
sudo systemctl restart sshd
|
20
|
+
|
21
|
+
# change vagrant user to require sudo password
|
22
|
+
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD: ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
|
23
|
+
|
24
|
+
# sudo sh -c 'echo root:foo | chpasswd'
|
25
|
+
SHELL
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.box = "bento/debian-12"
|
6
|
+
|
7
|
+
config.vm.network "private_network", ip: "192.168.56.11"
|
8
|
+
|
9
|
+
config.ssh.forward_agent = true
|
10
|
+
|
11
|
+
config.vm.provision "shell" do |s|
|
12
|
+
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_ops.pub").first.strip
|
13
|
+
s.inline = <<-SHELL
|
14
|
+
# echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
|
15
|
+
# echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
|
16
|
+
|
17
|
+
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
18
|
+
sudo systemctl restart sshd
|
19
|
+
|
20
|
+
# change vagrant user to require sudo password
|
21
|
+
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD:ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
|
22
|
+
|
23
|
+
# sudo sh -c 'echo root:foo | chpasswd'
|
24
|
+
SHELL
|
25
|
+
end
|
26
|
+
end
|
@@ -8,11 +8,11 @@ Vagrant.configure("2") do |config|
|
|
8
8
|
|
9
9
|
# Every Vagrant development environment requires a box. You can search for
|
10
10
|
# boxes at https://vagrantcloud.com/search.
|
11
|
-
config.vm.box = "fedora
|
11
|
+
config.vm.box = "bento/fedora-38"
|
12
12
|
|
13
13
|
# Create a private network, which allows host-only access to the machine
|
14
14
|
# using a specific IP.
|
15
|
-
config.vm.network "private_network", ip: "192.168.56.
|
15
|
+
config.vm.network "private_network", ip: "192.168.56.12"
|
16
16
|
|
17
17
|
# config.ssh.insert_key = false
|
18
18
|
config.ssh.forward_agent = true
|
@@ -0,0 +1,55 @@
|
|
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 = "bento/freebsd-13"
|
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.13"
|
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
|
+
echo "tmpfs /tmp tmpfs rw,nodev,nosuid,size=5G 0 0" | sudo tee -a /etc/fstab
|
33
|
+
|
34
|
+
# this helps to address the issue where new builds of fedora do not honor the vagrant network config settings
|
35
|
+
sudo dnf install -yq NetworkManager-initscripts-ifcfg-rh
|
36
|
+
|
37
|
+
# this migrates the old network management config to the new style
|
38
|
+
sudo nmcli connection migrate
|
39
|
+
|
40
|
+
# # per https://github.com/hashicorp/vagrant/issues/12762#issuecomment-1535957837 :
|
41
|
+
# sudo nmcli conn modify 'Wired connection 2' ipv4.addresses $(cat /etc/sysconfig/network-scripts/ifcfg-eth1 | grep IPADDR | cut -d "=" -f2)
|
42
|
+
# sudo nmcli conn modify 'Wired connection 2' ipv4.method manual
|
43
|
+
# sudo systemctl restart NetworkManager
|
44
|
+
|
45
|
+
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
46
|
+
sudo systemctl restart sshd
|
47
|
+
|
48
|
+
nohup sudo -b bash -c 'sleep 3; reboot' &>/dev/null;
|
49
|
+
|
50
|
+
# change vagrant user to require sudo password
|
51
|
+
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD: ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant-nopasswd
|
52
|
+
|
53
|
+
# sudo sh -c 'echo root:foo | chpasswd'
|
54
|
+
SHELL
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 = "bento/rockylinux-9"
|
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.14"
|
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
|
+
echo "tmpfs /tmp tmpfs rw,nodev,nosuid,size=5G 0 0" | sudo tee -a /etc/fstab
|
33
|
+
|
34
|
+
# this helps to address the issue where new builds of fedora do not honor the vagrant network config settings
|
35
|
+
sudo dnf install -yq NetworkManager-initscripts-ifcfg-rh
|
36
|
+
|
37
|
+
# this migrates the old network management config to the new style
|
38
|
+
sudo nmcli connection migrate
|
39
|
+
|
40
|
+
# # per https://github.com/hashicorp/vagrant/issues/12762#issuecomment-1535957837 :
|
41
|
+
# sudo nmcli conn modify 'Wired connection 2' ipv4.addresses $(cat /etc/sysconfig/network-scripts/ifcfg-eth1 | grep IPADDR | cut -d "=" -f2)
|
42
|
+
# sudo nmcli conn modify 'Wired connection 2' ipv4.method manual
|
43
|
+
# sudo systemctl restart NetworkManager
|
44
|
+
|
45
|
+
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
46
|
+
sudo systemctl restart sshd
|
47
|
+
|
48
|
+
nohup sudo -b bash -c 'sleep 3; reboot' &>/dev/null;
|
49
|
+
|
50
|
+
# change vagrant user to require sudo password
|
51
|
+
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD: ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant-nopasswd
|
52
|
+
|
53
|
+
# sudo sh -c 'echo root:foo | chpasswd'
|
54
|
+
SHELL
|
55
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.box = "bento/ubuntu-22.04"
|
6
|
+
|
7
|
+
config.vm.network "private_network", ip: "192.168.56.15"
|
8
|
+
|
9
|
+
config.ssh.forward_agent = true
|
10
|
+
|
11
|
+
config.vm.provision "shell" do |s|
|
12
|
+
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_ops.pub").first.strip
|
13
|
+
s.inline = <<-SHELL
|
14
|
+
# echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
|
15
|
+
# echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
|
16
|
+
|
17
|
+
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
18
|
+
sudo systemctl restart sshd
|
19
|
+
|
20
|
+
# change vagrant user to require sudo password
|
21
|
+
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD:ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
|
22
|
+
|
23
|
+
# sudo sh -c 'echo root:foo | chpasswd'
|
24
|
+
SHELL
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opswalrus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Ellis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -229,9 +229,13 @@ files:
|
|
229
229
|
- lib/opswalrus/zip.rb
|
230
230
|
- opswalrus.gemspec
|
231
231
|
- sig/opswalrus.rbs
|
232
|
-
-
|
233
|
-
- vms/
|
234
|
-
- vms/
|
232
|
+
- test.rb
|
233
|
+
- vms/arch/Vagrantfile
|
234
|
+
- vms/debian/Vagrantfile
|
235
|
+
- vms/fedora/Vagrantfile
|
236
|
+
- vms/freebsd/Vagrantfile
|
237
|
+
- vms/rocky/Vagrantfile
|
238
|
+
- vms/ubuntu/Vagrantfile
|
235
239
|
homepage: https://github.com/opswalrus/opswalrus
|
236
240
|
licenses:
|
237
241
|
- EPL-2.0
|
data/vms/web-arch/Vagrantfile
DELETED
@@ -1,92 +0,0 @@
|
|
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" do |s|
|
78
|
-
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_ops.pub").first.strip
|
79
|
-
s.inline = <<-SHELL
|
80
|
-
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
|
81
|
-
echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
|
82
|
-
|
83
|
-
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
84
|
-
sudo systemctl restart sshd
|
85
|
-
|
86
|
-
# change vagrant user to require sudo password
|
87
|
-
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD: ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
|
88
|
-
|
89
|
-
# sudo sh -c 'echo root:foo | chpasswd'
|
90
|
-
SHELL
|
91
|
-
end
|
92
|
-
end
|
data/vms/web-ubuntu/Vagrantfile
DELETED
@@ -1,38 +0,0 @@
|
|
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" do |s|
|
24
|
-
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_ops.pub").first.strip
|
25
|
-
s.inline = <<-SHELL
|
26
|
-
# echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
|
27
|
-
# echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
|
28
|
-
|
29
|
-
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
30
|
-
sudo systemctl restart sshd
|
31
|
-
|
32
|
-
# change vagrant user to require sudo password
|
33
|
-
sudo sed -i 's/vagrant ALL=(ALL) NOPASSWD:ALL/vagrant ALL=(ALL:ALL) ALL/g' /etc/sudoers.d/vagrant
|
34
|
-
|
35
|
-
# sudo sh -c 'echo root:foo | chpasswd'
|
36
|
-
SHELL
|
37
|
-
end
|
38
|
-
end
|