Home Lab
My home lab setup currently consists of a single “worker” (where I run portainer and all of my containers for the services my home needs) and a small Ubiquity setup. I serves me well and I am very please with it so far. I wanted to start to spin up some more containers and also test some thing out and figure it would be a good idea to add some more resources to the pool. I was about to hook up my desk setup to the new worker and I thought that I would really like if this was automated…
Steps to Automate to Add a Worker to the Lab
Get MAC address of the NIC
Manual
I cabled up the new worker to my desktop switch and waited a few seconds for him to show up on my network and then used a fixed address and renamed him.
![worker_unify](https://rjgonza.com/images/worker_unifi.png)
Automated
Reserve IP address and associate MAC address on DHCP server
Manual
Then I chose an alias for him and allowed the IP to be reserved on the DHCP server.
![worker_fixedIP](https://rjgonza.com/images/worker_fixedIP.png)
Automated
Add DNS Entries Pointing at the New Worker
Manual
I am using an awesome dnsmasq container that has a cute go wrapper to serve a UI for the config. At the bottom of the config I just add something like this:
456
457
458
459
460
461
462
|
conf-dir=/etc/dnsmasq.d
server=1.1.1.1
server=8.8.8.8
server=/gonzalez/xxx.xxx.xxx.xxx
address=/worker1.expo.gonzalez/xxx.xxx.xxx.xxx
address=/unifi.expo.gonzalez/xxx.xxx.xxx.xxx
address=/worker2.expo.gonzalez/xxx.xxx.xxx.xxx
|
Automated
Netboot Worker with CentOS
Manual
In order to work on the build I decided that I would just install via USB while I am still setting up the environment and tools to have a worker bootstrapping environment.
Automated
Ansible Playbook Run to Hammer Worker Into the Desired State
Manual
In order to know what packages and settings I needed I figured that I would just ssh over to the newly built host and then start setting it up. I would record all the steps and things I wanted to change and then look for existing playbook on Ansible Galaxy for it. If it was there I would pull that module down to my repo (maybe as a submodule or subtree). If I couldn’t find it then I would just build it up myself – hopefully it would something that could be helpful to someone else.
Install VIM
Need a real editor so I first need to grab vi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
[root@localhost ~]# yum install vim
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirror.math.princeton.edu
* extras: mirror.math.princeton.edu
* updates: mirror.math.princeton.edu
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 165 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 152 kB 00:00:00
(3/4): updates/7/x86_64/primary_db | 1.9 MB 00:00:00
(4/4): base/7/x86_64/primary_db | 6.0 MB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-6.el7 for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: perl(:MODULE_COMPAT_5.16.3) for package: :vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package perl.x86_64 4:5.16.3-294.el7_6 will be installed
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package :perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: :perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-294.el7_6.x86_64
---> Package perl-libs.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package vim-common.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-4.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
---> Package vim-filesystem.x86_64 2:7.4.629-6.el7 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-294.el7_6 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-6.el7 base 1.1 M
Installing for dependencies:
perl x86_64 4:5.16.3-294.el7_6 base 8.0 M
perl-Carp noarch 1.26-244.el7 base 19 k
perl-Encode x86_64 2.51-7.el7 base 1.5 M
perl-Exporter noarch 5.68-3.el7 base 28 k
perl-File-Path noarch 2.09-2.el7 base 26 k
perl-File-Temp noarch 0.23.01-3.el7 base 56 k
perl-Filter x86_64 1.49-3.el7 base 76 k
perl-Getopt-Long noarch 2.40-3.el7 base 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k
perl-PathTools x86_64 3.40-5.el7 base 82 k
perl-Pod-Escapes noarch 1:1.04-294.el7_6 base 51 k
perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k
perl-Pod-Usage noarch 1.63-3.el7 base 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k
perl-Socket x86_64 2.010-4.el7 base 49 k
perl-Storable x86_64 2.45-3.el7 base 77 k
perl-Text-ParseWords noarch 3.29-4.el7 base 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k
perl-Time-Local noarch 1.2300-2.el7 base 24 k
perl-constant noarch 1.27-2.el7 base 19 k
perl-libs x86_64 4:5.16.3-294.el7_6 base 688 k
perl-macros x86_64 4:5.16.3-294.el7_6 base 44 k
perl-parent noarch 1:0.225-244.el7 base 12 k
perl-podlators noarch 2.5.1-3.el7 base 112 k
perl-threads x86_64 1.87-4.el7 base 49 k
perl-threads-shared x86_64 1.43-6.el7 base 39 k
vim-common x86_64 2:7.4.629-6.el7 base 5.9 M
vim-filesystem x86_64 2:7.4.629-6.el7 base 11 k
Transaction Summary
=========================================================================================================================================
Install 1 Package (+29 Dependent packages)
Total download size: 18 M
Installed size: 60 M
Is this ok [y/d/N]: y
Downloading packages:
(1/30): perl-Carp-1.26-244.el7.noarch.rpm | 19 kB 00:00:00
(2/30): perl-Exporter-5.68-3.el7.noarch.rpm | 28 kB 00:00:00
(3/30): perl-Encode-2.51-7.el7.x86_64.rpm | 1.5 MB 00:00:00
(4/30): perl-File-Path-2.09-2.el7.noarch.rpm | 26 kB 00:00:00
(5/30): perl-Getopt-Long-2.40-3.el7.noarch.rpm | 56 kB 00:00:00
(6/30): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm | 38 kB 00:00:00
(7/30): perl-PathTools-3.40-5.el7.x86_64.rpm | 82 kB 00:00:00
(8/30): perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm | 51 kB 00:00:00
(9/30): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm | 87 kB 00:00:0
(10/30): perl-Pod-Simple-3.28-4.el7.noarch.rpm | 216 kB 00:00:00
(11/30): perl-File-Temp-0.23.01-3.el7.noarch.rpm | 56 kB 00:00:00
(12/30): perl-Pod-Usage-1.63-3.el7.noarch.rpm | 27 kB 00:00:00
(13/30): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm | 36 kB 00:00:00
(14/30): perl-Socket-2.010-4.el7.x86_64.rpm | 49 kB 00:00:00
(15/30): perl-Filter-1.49-3.el7.x86_64.rpm | 76 kB 00:00:00
(16/30): perl-Storable-2.45-3.el7.x86_64.rpm | 77 kB 00:00:00
(17/30): perl-Text-ParseWords-3.29-4.el7.noarch.rpm | 14 kB 00:00:00
(18/30): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm | 45 kB 00:00:00
(19/30): perl-constant-1.27-2.el7.noarch.rpm | 19 kB 00:00:00
(20/30): perl-macros-5.16.3-294.el7_6.x86_64.rpm | 44 kB 00:00:00
(21/30): perl-Time-Local-1.2300-2.el7.noarch.rpm | 24 kB 00:00:00
(22/30): perl-libs-5.16.3-294.el7_6.x86_64.rpm | 688 kB 00:00:00
(23/30): perl-parent-0.225-244.el7.noarch.rpm | 12 kB 00:00:00
(24/30): perl-threads-shared-1.43-6.el7.x86_64.rpm | 39 kB 00:00:00
(25/30): perl-podlators-2.5.1-3.el7.noarch.rpm | 112 kB 00:00:00
(26/30): perl-threads-1.87-4.el7.x86_64.rpm | 49 kB 00:00:00
(27/30): perl-5.16.3-294.el7_6.x86_64.rpm | 8.0 MB 00:00:00
(28/30): vim-filesystem-7.4.629-6.el7.x86_64.rpm | 11 kB 00:00:00
(29/30): vim-enhanced-7.4.629-6.el7.x86_64.rpm | 1.1 MB 00:00:00
(30/30): vim-common-7.4.629-6.el7.x86_64.rpm | 5.9 MB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------
Total 17 MB/s | 18 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:perl-parent-0.225-244.el7.noarch 1/30
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 2/30
Installing : perl-podlators-2.5.1-3.el7.noarch 3/30
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 4/30
Installing : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch 5/30
Installing : perl-Text-ParseWords-3.29-4.el7.noarch 6/30
Installing : perl-Encode-2.51-7.el7.x86_64 7/30
Installing : perl-Pod-Usage-1.63-3.el7.noarch 8/30
Installing : 4:perl-libs-5.16.3-294.el7_6.x86_64 9/30
Installing : 4:perl-macros-5.16.3-294.el7_6.x86_64 10/30
Installing : perl-Storable-2.45-3.el7.x86_64 11/30
Installing : perl-Exporter-5.68-3.el7.noarch 12/30
Installing : perl-constant-1.27-2.el7.noarch 13/30
Installing : perl-Time-Local-1.2300-2.el7.noarch 14/30
Installing : perl-Carp-1.26-244.el7.noarch 15/30
Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 16/30
Installing : perl-PathTools-3.40-5.el7.x86_64 17/30
Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 18/30
Installing : perl-File-Temp-0.23.01-3.el7.noarch 19/30
Installing : perl-File-Path-2.09-2.el7.noarch 20/30
Installing : perl-threads-shared-1.43-6.el7.x86_64 21/30
Installing : perl-threads-1.87-4.el7.x86_64 22/30
Installing : perl-Filter-1.49-3.el7.x86_64 23/30
Installing : perl-Socket-2.010-4.el7.x86_64 24/30
Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 25/30
Installing : perl-Getopt-Long-2.40-3.el7.noarch 26/30
Installing : 4:perl-5.16.3-294.el7_6.x86_64 27/30
Installing : 2:vim-filesystem-7.4.629-6.el7.x86_64 28/30
Installing : 2:vim-common-7.4.629-6.el7.x86_64 29/30
Installing : 2:vim-enhanced-7.4.629-6.el7.x86_64 30/30
Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/30
Verifying : perl-threads-shared-1.43-6.el7.x86_64 2/30
Verifying : perl-Storable-2.45-3.el7.x86_64 3/30
Verifying : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch 4/30
Verifying : perl-Exporter-5.68-3.el7.noarch 5/30
Verifying : perl-constant-1.27-2.el7.noarch 6/30
Verifying : perl-PathTools-3.40-5.el7.x86_64 7/30
Verifying : 1:perl-parent-0.225-244.el7.noarch 8/30
Verifying : 4:perl-libs-5.16.3-294.el7_6.x86_64 9/30
Verifying : perl-File-Temp-0.23.01-3.el7.noarch 10/30
Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 11/30
Verifying : perl-Time-Local-1.2300-2.el7.noarch 12/30
Verifying : 4:perl-macros-5.16.3-294.el7_6.x86_64 13/30
Verifying : 4:perl-5.16.3-294.el7_6.x86_64 14/30
Verifying : 2:vim-enhanced-7.4.629-6.el7.x86_64 15/30
Verifying : perl-Carp-1.26-244.el7.noarch 16/30
Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 17/30
Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 18/30
Verifying : perl-Pod-Usage-1.63-3.el7.noarch 19/30
Verifying : 2:vim-common-7.4.629-6.el7.x86_64 20/30
Verifying : 2:vim-filesystem-7.4.629-6.el7.x86_64 21/30
Verifying : perl-Encode-2.51-7.el7.x86_64 22/30
Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 23/30
Verifying : perl-podlators-2.5.1-3.el7.noarch 24/30
Verifying : perl-File-Path-2.09-2.el7.noarch 25/30
Verifying : perl-threads-1.87-4.el7.x86_64 26/30
Verifying : perl-Filter-1.49-3.el7.x86_64 27/30
Verifying : perl-Getopt-Long-2.40-3.el7.noarch 28/30
Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 29/30
Verifying : perl-Socket-2.010-4.el7.x86_64 30/30
Installed:
vim-enhanced.x86_64 2:7.4.629-6.el7
Dependency Installed:
perl.x86_64 4:5.16.3-294.el7_6 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7
perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7
perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7
perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-294.el7_6 perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
perl-Socket.x86_64 0:2.010-4.el7 perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7
perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7
perl-libs.x86_64 4:5.16.3-294.el7_6 perl-macros.x86_64 4:5.16.3-294.el7_6 perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7
vim-common.x86_64 2:7.4.629-6.el7 vim-filesystem.x86_64 2:7.4.629-6.el7
Complete!
[root@localhost ~]#
|
Disable SELinux
1
2
3
4
5
6
7
8
9
10
|
[root@localhost ~]# vim /etc/selinux/config
[root@localhost ~]# grep SELINUX /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
SELINUXTYPE=targeted
[root@localhost ~]#
[root@localhost ~]# shutdown -r now
Connection to worker2 closed by remote host.
Connection to worker2 closed.
|
Need to reboot for these change to take effect
1
2
3
4
5
|
[root@localhost ~]# uptime
14:48:09 up 0 min, 1 user, load average: 0.07, 0.03, 0.01
[root@localhost ~]# getenforce
Disabled
[root@localhost ~]#
|
Add my preferred user
1
2
3
4
5
6
7
|
[root@localhost ~]# adduser ramon.gonzalez
[root@localhost ~]# passwd ramon.gonzalez
Changing password for user ramon.gonzalez.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
|
Add sudo permission to my user
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@localhost ~]# visudo
[root@localhost ~]# su ramon.gonzalez
[ramon.gonzalez@localhost root]$ sudo echo "turd"
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for ramon.gonzalez:
turd
[ramon.gonzalez@localhost root]$
|
Install docker
Using the instructions from docker itself.
Adding some needed tools:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.math.princeton.edu
* extras: mirror.math.princeton.edu
* updates: mirror.math.princeton.edu
Package yum-utils-1.1.31-52.el7.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.7.3-3.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-1.el7 will be an update
---> Package lvm2.x86_64 7:2.02.180-8.el7 will be updated
---> Package lvm2.x86_64 7:2.02.185-2.el7 will be an update
--> Processing Dependency: lvm2-libs = 7:2.02.185-2.el7 for package: 7:lvm2-2.02.185-2.el7.x86_64
--> Running transaction check
---> Package lvm2-libs.x86_64 7:2.02.180-8.el7 will be updated
---> Package lvm2-libs.x86_64 7:2.02.185-2.el7 will be an update
--> Processing Dependency: device-mapper-event = 7:1.02.158-2.el7 for package: 7:lvm2-libs-2.02.185-2.el7.x86_64
--> Running transaction check
---> Package device-mapper-event.x86_64 7:1.02.149-8.el7 will be updated
---> Package device-mapper-event.x86_64 7:1.02.158-2.el7 will be an update
--> Processing Dependency: device-mapper-event-libs = 7:1.02.158-2.el7 for package: 7:device-mapper-event-1.02.158-2.el7.x86_64
--> Processing Dependency: device-mapper = 7:1.02.158-2.el7 for package: 7:device-mapper-event-1.02.158-2.el7.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.149-8.el7 will be updated
--> Processing Dependency: device-mapper = 7:1.02.149-8.el7 for package: 7:device-mapper-libs-1.02.149-8.el7.x86_64
---> Package device-mapper.x86_64 7:1.02.158-2.el7 will be an update
---> Package device-mapper-event-libs.x86_64 7:1.02.149-8.el7 will be updated
---> Package device-mapper-event-libs.x86_64 7:1.02.158-2.el7 will be an update
--> Running transaction check
---> Package device-mapper-libs.x86_64 7:1.02.149-8.el7 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.158-2.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================
Updating:
device-mapper-persistent-data x86_64 0.8.5-1.el7 base 423 k
lvm2 x86_64 7:2.02.185-2.el7 base 1.3 M
Updating for dependencies:
device-mapper x86_64 7:1.02.158-2.el7 base 294 k
device-mapper-event x86_64 7:1.02.158-2.el7 base 189 k
device-mapper-event-libs x86_64 7:1.02.158-2.el7 base 189 k
device-mapper-libs x86_64 7:1.02.158-2.el7 base 322 k
lvm2-libs x86_64 7:2.02.185-2.el7 base 1.1 M
Transaction Summary
=========================================================================================================================================
Upgrade 2 Packages (+5 Dependent packages)
Total download size: 3.8 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/7): device-mapper-event-1.02.158-2.el7.x86_64.rpm | 189 kB 00:00:00
(2/7): device-mapper-event-libs-1.02.158-2.el7.x86_64.rpm | 189 kB 00:00:00
(3/7): device-mapper-1.02.158-2.el7.x86_64.rpm | 294 kB 00:00:00
(4/7): device-mapper-persistent-data-0.8.5-1.el7.x86_64.rpm | 423 kB 00:00:00
(5/7): device-mapper-libs-1.02.158-2.el7.x86_64.rpm | 322 kB 00:00:00
(6/7): lvm2-2.02.185-2.el7.x86_64.rpm | 1.3 MB 00:00:00
(7/7): lvm2-libs-2.02.185-2.el7.x86_64.rpm | 1.1 MB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------
Total 12 MB/s | 3.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 7:device-mapper-libs-1.02.158-2.el7.x86_64 1/14
Updating : 7:device-mapper-1.02.158-2.el7.x86_64 2/14
Updating : 7:device-mapper-event-libs-1.02.158-2.el7.x86_64 3/14
Updating : 7:device-mapper-event-1.02.158-2.el7.x86_64 4/14
Updating : 7:lvm2-libs-2.02.185-2.el7.x86_64 5/14
Updating : device-mapper-persistent-data-0.8.5-1.el7.x86_64 6/14
Updating : 7:lvm2-2.02.185-2.el7.x86_64 7/14
Cleanup : 7:lvm2-2.02.180-8.el7.x86_64 8/14
Cleanup : 7:lvm2-libs-2.02.180-8.el7.x86_64 9/14
Cleanup : 7:device-mapper-event-1.02.149-8.el7.x86_64 10/14
Cleanup : 7:device-mapper-event-libs-1.02.149-8.el7.x86_64 11/14
Cleanup : 7:device-mapper-1.02.149-8.el7.x86_64 12/14
Cleanup : 7:device-mapper-libs-1.02.149-8.el7.x86_64 13/14
Cleanup : device-mapper-persistent-data-0.7.3-3.el7.x86_64 14/14
Verifying : 7:device-mapper-event-1.02.158-2.el7.x86_64 1/14
Verifying : device-mapper-persistent-data-0.8.5-1.el7.x86_64 2/14
Verifying : 7:device-mapper-event-libs-1.02.158-2.el7.x86_64 3/14
Verifying : 7:device-mapper-1.02.158-2.el7.x86_64 4/14
Verifying : 7:device-mapper-libs-1.02.158-2.el7.x86_64 5/14
Verifying : 7:lvm2-libs-2.02.185-2.el7.x86_64 6/14
Verifying : 7:lvm2-2.02.185-2.el7.x86_64 7/14
Verifying : device-mapper-persistent-data-0.7.3-3.el7.x86_64 8/14
Verifying : 7:lvm2-2.02.180-8.el7.x86_64 9/14
Verifying : 7:device-mapper-event-1.02.149-8.el7.x86_64 10/14
Verifying : 7:lvm2-libs-2.02.180-8.el7.x86_64 11/14
Verifying : 7:device-mapper-1.02.149-8.el7.x86_64 12/14
Verifying : 7:device-mapper-event-libs-1.02.149-8.el7.x86_64 13/14
Verifying : 7:device-mapper-libs-1.02.149-8.el7.x86_64 14/14
Updated:
device-mapper-persistent-data.x86_64 0:0.8.5-1.el7 lvm2.x86_64 7:2.02.185-2.el7
Dependency Updated:
device-mapper.x86_64 7:1.02.158-2.el7 device-mapper-event.x86_64 7:1.02.158-2.el7
device-mapper-event-libs.x86_64 7:1.02.158-2.el7 device-mapper-libs.x86_64 7:1.02.158-2.el7
lvm2-libs.x86_64 7:2.02.185-2.el7
Complete!
[root@localhost ~]#
|
Adding the docker repo
1
2
3
4
5
6
7
|
[root@localhost ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost ~]#
|
Install docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
[root@localhost ~]# yum install docker-ce
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.math.princeton.edu
* extras: mirror.math.princeton.edu
* updates: mirror.math.princeton.edu
docker-ce-stable | 3.5 kB 00:00:00
(1/2): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00
(2/2): docker-ce-stable/x86_64/primary_db | 37 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:19.03.4-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-19.03.4-3.el7.x86_64
--> Processing Dependency: containerd.io >= 1.2.2-3 for package: 3:docker-ce-19.03.4-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-19.03.4-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.107-3.el7 will be installed
---> Package containerd.io.x86_64 0:1.2.10-3.2.el7 will be installed
---> Package docker-ce-cli.x86_64 1:19.03.4-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================
Installing:
docker-ce x86_64 3:19.03.4-3.el7 docker-ce-stable 24 M
Installing for dependencies:
container-selinux noarch 2:2.107-3.el7 extras 39 k
containerd.io x86_64 1.2.10-3.2.el7 docker-ce-stable 23 M
docker-ce-cli x86_64 1:19.03.4-3.el7 docker-ce-stable 39 M
Transaction Summary
=========================================================================================================================================Install 1 Package (+3 Dependent packages)
Total download size: 87 M
Installed size: 362 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): container-selinux-2.107-3.el7.noarch.rpm | 39 kB 00:00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY Public key for containerd.io-1.2.10-3.2.el7.x86_64.rpm is not installed
(2/4): containerd.io-1.2.10-3.2.el7.x86_64.rpm | 23 MB 00:00:00
(3/4): docker-ce-19.03.4-3.el7.x86_64.rpm | 24 MB 00:00:00
(4/4): docker-ce-cli-19.03.4-3.el7.x86_64.rpm | 39 MB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------
Total 72 MB/s | 87 MB 00:00:01
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:container-selinux-2.107-3.el7.noarch 1/4: SELinux is disabled.
Installing : containerd.io-1.2.10-3.2.el7.x86_64 2/4
Installing : 1:docker-ce-cli-19.03.4-3.el7.x86_64 3/4
Installing : 3:docker-ce-19.03.4-3.el7.x86_64 4/4
Verifying : 1:docker-ce-cli-19.03.4-3.el7.x86_64 1/4
Verifying : 3:docker-ce-19.03.4-3.el7.x86_64 2/4
Verifying : containerd.io-1.2.10-3.2.el7.x86_64 3/4
Verifying : 2:container-selinux-2.107-3.el7.noarch 4/4
Installed:
docker-ce.x86_64 3:19.03.4-3.el7
Dependency Installed:
container-selinux.noarch 2:2.107-3.el7 containerd.io.x86_64 0:1.2.10-3.2.el7 docker-ce-cli.x86_64 1:19.03.4-3.el7
Complete!
[root@localhost ~]#
|
Finally I would add my ssh-key to the newly built host:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
rjgonza@WinRoy:~$ ssh worker2
Enter passphrase for key '/home/rjgonza/.ssh/id_rsa':
rjgonza@WinRoy:~$ ssh-copy-id worker2
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Enter passphrase for key '/home/rjgonza/.ssh/id_rsa':
ramon.gonzalez@worker2's password:
Permission denied, please try again.
ramon.gonzalez@worker2's password:
Number of key(s) added: 1
Now try logging into the machine, with:"ssh 'worker2'"
and check to make sure that only the key(s) you wanted were added.
rjgonza@WinRoy:~$
|
Disable firewall
1
2
3
4
5
|
[root@worker2 ~]# systemctl stop firewalld
[root@worker2 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@worker2 ~]#
|
Automated
Move Newly built Worker Into Physical Location
Manual
I just carried the little guy over there:
![worker2](https://rjgonza.com/images/worker2.jpg)
Automated
Add Docker Socket On the New Worker to the Current Portainer Instance
Manual
Now I just head over to portainer and added a new docker API endpoint and done.
![portainer](https://rjgonza.com/images/portainer_endpoint_add.png)
Automated
In the next couple posts I will go over automating these steps and then try it all out on worker3.