opswalrus 1.0.26 → 1.0.28
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/app.rb +8 -3
- data/lib/opswalrus/bootstrap.ops +2 -1
- data/lib/opswalrus/bootstrap.sh +105 -24
- data/lib/opswalrus/host.rb +6 -2
- data/lib/opswalrus/version.rb +1 -1
- data/vms/web-fedora/Vagrantfile +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ed3ebf666e1e12461a109ace60e4429008e5016fde3c4f0605e1b1f0e8c3a01
|
4
|
+
data.tar.gz: 88a949890ddb41d16d69e667e6440e4894a4d1ef369b0e4db301ce5f751c5570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8625724d93eea350e367d57468b8c4072a3f1e4946469afba2e950305b93d564e056afd368ee5af5c44483364ed41b3aa003bedeabb6e40281c0d65c6a10f8be
|
7
|
+
data.tar.gz: c75cfe115140ec4bcb09059e9f3ce96ea2b51bca4c60552221a53f4415c91b3da55ad1acef2f61fcf08cb93cfb20580390317862fa9f288f56a8787959189324
|
data/Gemfile.lock
CHANGED
data/lib/opswalrus/app.rb
CHANGED
@@ -57,6 +57,7 @@ module OpsWalrus
|
|
57
57
|
@local_hostname = "localhost"
|
58
58
|
@mode = :report # :report | :script
|
59
59
|
@dry_run = false
|
60
|
+
@zip_mutex = Thread::Mutex.new
|
60
61
|
end
|
61
62
|
|
62
63
|
def to_s
|
@@ -414,9 +415,13 @@ module OpsWalrus
|
|
414
415
|
end
|
415
416
|
|
416
417
|
def zip
|
417
|
-
|
418
|
-
|
419
|
-
|
418
|
+
@zip ||= begin
|
419
|
+
@zip_mutex.synchronize do
|
420
|
+
tmpzip = pwd.join("tmpops.zip")
|
421
|
+
FileUtils.rm(tmpzip) if tmpzip.exist?
|
422
|
+
DirZipper.zip(pwd, tmpzip)
|
423
|
+
end
|
424
|
+
end
|
420
425
|
end
|
421
426
|
|
422
427
|
end
|
data/lib/opswalrus/bootstrap.ops
CHANGED
data/lib/opswalrus/bootstrap.sh
CHANGED
@@ -1,19 +1,37 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
export PATH="$HOME/.local/share/rtx/bin:$PATH" # this is key for activating rtx without running `eval "$($RTX activate bash)"`
|
4
|
+
RTX="$HOME/.local/share/rtx/bin/rtx"
|
5
|
+
rtx_init() { eval "$($RTX activate bash)"; }
|
6
|
+
# RTX_RUBY="$HOME/.local/share/rtx/bin/rtx x ruby -- ruby"
|
7
|
+
# RTX_GEM="$HOME/.local/share/rtx/bin/rtx x ruby -- gem"
|
8
|
+
RTX_RUBY="$HOME/.local/share/rtx/shims/ruby"
|
9
|
+
RTX_GEM="$HOME/.local/share/rtx/shims/gem"
|
10
|
+
RUBY_CMD=$RTX_RUBY
|
11
|
+
GEM_CMD=$RTX_GEM
|
12
|
+
# RUBY_CMD="ruby"
|
13
|
+
# GEM_CMD="gem"
|
14
|
+
|
15
|
+
if [ -x $RTX ]; then
|
16
|
+
# rtx_init;
|
17
|
+
# eval "$($RTX activate bash)"
|
18
|
+
# if brew is already installed, initialize this shell environment with brew
|
19
|
+
# if [ -x "$(command -v /home/linuxbrew/.linuxbrew/bin/brew)" ]; then
|
20
|
+
if $RUBY_CMD -e "major, minor, patch = RUBY_VERSION.split('.'); exit 1 unless major.to_i >= 3"; then
|
21
|
+
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
22
|
+
|
23
|
+
# exit early if ruby already exists
|
24
|
+
# if [ -x "$(command -v $HOME/.rubies/ruby-3.2.2/bin/ruby)" ]; then
|
25
|
+
echo 'Ruby is already installed.'
|
26
|
+
|
27
|
+
# make sure the latest opswalrus gem is installed
|
28
|
+
# todo: figure out how to install this differently, so that test versions will work
|
29
|
+
# gem install opswalrus
|
30
|
+
$GEM_CMD install opswalrus
|
31
|
+
$RTX reshim
|
32
|
+
|
33
|
+
exit 0
|
34
|
+
# fi
|
17
35
|
fi
|
18
36
|
fi
|
19
37
|
|
@@ -42,7 +60,7 @@ elif echo $OS | grep -q 'fedora'; then
|
|
42
60
|
sudo dnf groupinstall -y 'Development Tools'
|
43
61
|
sudo dnf -yq install procps-ng curl file git
|
44
62
|
elif echo $OS | grep -q 'arch'; then
|
45
|
-
sudo pacman -Syu --noconfirm base-devel procps-ng curl file git
|
63
|
+
sudo pacman -Syu --noconfirm --needed base-devel procps-ng curl file git
|
46
64
|
else
|
47
65
|
echo "unsupported OS"
|
48
66
|
exit 1
|
@@ -50,14 +68,15 @@ fi
|
|
50
68
|
|
51
69
|
|
52
70
|
# install homebrew
|
53
|
-
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
71
|
+
# NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
54
72
|
|
55
73
|
# initialize brew in shell session
|
56
|
-
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
74
|
+
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
75
|
+
|
76
|
+
# install gcc, age
|
77
|
+
# brew install gcc
|
78
|
+
# brew install age # https://github.com/FiloSottile/age
|
57
79
|
|
58
|
-
# install gcc, ruby, age
|
59
|
-
brew install gcc
|
60
|
-
brew install age # https://github.com/FiloSottile/age
|
61
80
|
|
62
81
|
### install ruby
|
63
82
|
|
@@ -67,14 +86,76 @@ brew install age # https://github.com/FiloSottile/age
|
|
67
86
|
|
68
87
|
# 2. via ruby-install
|
69
88
|
# brew install bash grep wget curl md5sha1sum sha2 gnu-tar bzip2 xz patchutils gcc
|
70
|
-
brew install ruby-install
|
71
|
-
ruby-install --update
|
72
|
-
ruby-install ruby 3.2.2
|
89
|
+
# brew install ruby-install
|
90
|
+
# ruby-install --update
|
91
|
+
# ruby-install ruby 3.2.2
|
73
92
|
|
74
93
|
# 3. rvm
|
75
94
|
# gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
76
95
|
# \curl -sSL https://get.rvm.io | bash -s stable --autolibs=homebrew
|
77
96
|
# rvm install 3.2.2
|
78
97
|
|
98
|
+
# 4. rtx (asdf clone)
|
99
|
+
if echo $OS | grep -q 'ubuntu'; then
|
100
|
+
# update package list
|
101
|
+
sudo apt update -qy
|
102
|
+
|
103
|
+
if [ -f /var/run/reboot-required ]; then
|
104
|
+
echo 'A system reboot is required!'
|
105
|
+
exit 1
|
106
|
+
fi
|
107
|
+
|
108
|
+
# install ruby dependencies
|
109
|
+
# see https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
110
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq libgdbm6
|
111
|
+
if [ $? -ne 0 ]; then
|
112
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq libgdbm5
|
113
|
+
fi
|
114
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm-dev libdb-dev uuid-dev
|
115
|
+
|
116
|
+
# restart services that need it
|
117
|
+
sudo needrestart -q -r a
|
118
|
+
sudo needrestart -q -r a
|
119
|
+
sudo needrestart -q -r a
|
120
|
+
elif echo $OS | grep -q 'fedora'; then
|
121
|
+
# from https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
122
|
+
sudo yum install -y gcc patch bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
|
123
|
+
elif echo $OS | grep -q 'arch'; then
|
124
|
+
# from https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
125
|
+
sudo pacman -Syu --noconfirm --needed base-devel rust libffi libyaml openssl zlib
|
126
|
+
else
|
127
|
+
echo "unsupported OS"
|
128
|
+
exit 1
|
129
|
+
fi
|
130
|
+
curl https://rtx.pub/install.sh | sh
|
131
|
+
# eval "$($HOME/.local/share/rtx/bin/rtx activate bash)"
|
132
|
+
$RTX use -g ruby@3.2
|
133
|
+
$RTX reshim
|
134
|
+
|
135
|
+
|
136
|
+
# 5. age
|
137
|
+
if echo $OS | grep -q 'ubuntu'; then
|
138
|
+
# update package list
|
139
|
+
sudo apt update -qy
|
140
|
+
|
141
|
+
if [ -f /var/run/reboot-required ]; then
|
142
|
+
echo 'A system reboot is required!'
|
143
|
+
exit 1
|
144
|
+
fi
|
145
|
+
|
146
|
+
sudo DEBIAN_FRONTEND=noninteractive apt install -yq age
|
147
|
+
|
148
|
+
# restart services that need it
|
149
|
+
sudo needrestart -q -r a
|
150
|
+
elif echo $OS | grep -q 'fedora'; then
|
151
|
+
sudo dnf -yq install age
|
152
|
+
elif echo $OS | grep -q 'arch'; then
|
153
|
+
sudo pacman -Syu --noconfirm --needed age
|
154
|
+
else
|
155
|
+
echo "unsupported OS"
|
156
|
+
exit 1
|
157
|
+
fi
|
158
|
+
|
79
159
|
# install opswalrus gem
|
80
|
-
$
|
160
|
+
$GEM_CMD install opswalrus
|
161
|
+
$RTX reshim
|
data/lib/opswalrus/host.rb
CHANGED
@@ -6,6 +6,9 @@ require_relative "invocation"
|
|
6
6
|
|
7
7
|
module OpsWalrus
|
8
8
|
|
9
|
+
OPS_GEM="$HOME/.local/share/rtx/shims/gem"
|
10
|
+
OPS_CMD="$HOME/.local/share/rtx/shims/ops"
|
11
|
+
|
9
12
|
# the subclasses of HostProxy will define methods that handle method dispatch via HostProxyOpsFileInvocationBuilder objects
|
10
13
|
class HostProxy
|
11
14
|
|
@@ -187,8 +190,9 @@ module OpsWalrus
|
|
187
190
|
host
|
188
191
|
end
|
189
192
|
|
190
|
-
# cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; /home/linuxbrew/.linuxbrew/bin/gem --conservative
|
191
|
-
cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; $
|
193
|
+
# cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; /home/linuxbrew/.linuxbrew/bin/gem exec --conservative -g opswalrus ops"
|
194
|
+
# cmd = "OPS_GEM=\"#{OPS_GEM}\" OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; $OPS_GEM exec --conservative -g opswalrus ops"
|
195
|
+
cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; #{OPS_CMD}"
|
192
196
|
cmd << " -v" if verbose
|
193
197
|
cmd << " #{ops_command.to_s}"
|
194
198
|
cmd << " #{ops_command_options.to_s}" if ops_command_options
|
data/lib/opswalrus/version.rb
CHANGED
data/vms/web-fedora/Vagrantfile
CHANGED
@@ -29,6 +29,9 @@ Vagrant.configure("2") do |config|
|
|
29
29
|
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
|
30
30
|
# documentation for more information about their specific syntax and use.
|
31
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
|
32
35
|
sudo dnf install -yq NetworkManager-initscripts-ifcfg-rh
|
33
36
|
|
34
37
|
# this migrates the old network management config to the new style
|