質問編集履歴

8

自己解決

2020/10/04 01:36

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- # 困っていこと
23
+ # 困っていこと1
24
24
 
25
25
  A stop job is running for Anaconda と表示され、1分30秒待たされます。
26
26
 
@@ -32,19 +32,13 @@
32
32
 
33
33
  標示させず、待たずにすむようにしたいです。
34
34
 
35
- **->postスクリプトを2回書いてることで、表示されているようで**
35
+ **->postスクリプトを2回書いてることで、表示されているようでした**
36
-
37
-
38
-
39
- # 表示されているメッセージについて
40
-
41
- kickstart の post script を書いてから、標示されるようになりました。
42
36
 
43
37
  ![表示されてるメッセージ](e5a280017f3c7ca98cc3ba4eb8a98c2c.jpeg)
44
38
 
45
39
 
46
40
 
47
- # 困っていこと2
41
+ # 困っていこと2
48
42
 
49
43
  nmcliでネットワーク設定をする場合、--nochroot 環境で nmcliを実行してから、
50
44
 
@@ -54,29 +48,23 @@
54
48
 
55
49
 
56
50
 
51
+
52
+
57
53
  # 試してみたこと
58
54
 
59
- kickstart post 実行中
55
+ ・postを2回書くのをやめて、pre, postに分けた。
60
-
61
- ls -al /mnt/sysimage/bin/bash で bash があったので、
56
+
62
-
63
- yum update -y する前に
64
-
65
- chroot /mnt/sysimage/ したのですが、
66
-
67
- yum update が実行せずに、lvcreate のみ実行されるような動きをており、
57
+ ・IPを振る部分をshellscriptに分けて、cron@rebootで呼び出すよう
68
-
69
- どのように設定するかで悩んでいます。
70
58
 
71
59
 
72
60
 
73
61
  # Kickstartの内容について
74
62
 
75
- kickstart は 以下のような内容になってい
63
+ 最終的な kickstart は 以下のような内容になした
76
64
 
77
65
  ```
78
66
 
79
- cat << 'EOF' > /var/pxe/ks/centos82-minimal.cfg
67
+ cat << 'EOC' > /var/pxe/ks/centos82-minimal.cfg
80
68
 
81
69
  #version=RHEL8
82
70
 
@@ -90,9 +78,9 @@
90
78
 
91
79
  # Use network installation
92
80
 
93
- url --url http://192.168.1.220/centos82-minimal/
81
+ url --url http://10.10.10.100/centos82-minimal/
94
-
82
+
95
- repo --name=Minimal --baseurl=http://192.168.1.220/centos82-minimal/Minimal
83
+ repo --name=Minimal --baseurl=http://10.10.10.100/centos82-minimal/Minimal
96
84
 
97
85
 
98
86
 
@@ -102,10 +90,6 @@
102
90
 
103
91
 
104
92
 
105
- # Run the Setup Agent on first boot
106
-
107
- firstboot --enable
108
-
109
93
  ignoredisk --only-use=nvme0n1
110
94
 
111
95
 
@@ -122,11 +106,15 @@
122
106
 
123
107
 
124
108
 
109
+ # Logging rsyslog
110
+
111
+ logging --host=10.10.10.100 --port=514 --level=debug
112
+
113
+
114
+
125
115
  # Network information
126
116
 
127
- # network --device=br0 --bridgeslaves=eth0 --bootproto=static --ip=192.168.1.222 --netmask=255.255.255.0 --gateway=192.168.1.1 --nameserver=8.8.8.8 --noipv6 --activate
128
-
129
- # network --device=br0 --bridgeslaves=eth0 --bootproto=dhcp --netmask=255.255.255.0 --gateway=192.168.1.1 --nameserver=8.8.8.8 --noipv6 --activate
117
+ # network --bootproto=static --device=br0 --bridgeslaves=eth0 --ip=10.10.10.222 --netmask=255.255.255.0 --gateway=10.10.10.1 --nameserver=8.8.8.8 --noipv6 --activate
130
118
 
131
119
  network --hostname=localhost.localdomain
132
120
 
@@ -134,7 +122,7 @@
134
122
 
135
123
  # Root password
136
124
 
137
- rootpw --iscrypted passpass
125
+ rootpw --iscrypted passpassworddd
138
126
 
139
127
 
140
128
 
@@ -236,246 +224,244 @@
236
224
 
237
225
 
238
226
 
227
+
228
+
229
+
230
+
239
- # Post script 1
231
+ # Pre script
240
-
232
+
241
- %post --nochroot --log=/mnt/sysimage/root/post1-ks.log
233
+ %pre --log=/tmp/ks-pre.log
234
+
242
-
235
+ # %post
236
+
243
-
237
+ # exec < /dev/tty3 | tee -a /tmp/ks-pre.log > /dev/tty3
244
-
238
+
245
- echo 'nmcli c ==='
239
+ # /usr/bin/chvt 3
240
+
241
+ # set -x
242
+
243
+ echo "################################"
244
+
245
+ echo "# Running Pre Configuration #"
246
+
247
+ echo "################################"
248
+
249
+
246
250
 
247
251
  nmcli c
248
252
 
253
+ nmcli c a type bridge con-name br0 ifname br0 stp no autoconnect yes
254
+
249
- echo 'nmcli c ==='
255
+ nmcli c m br0 ipv4.method auto
256
+
250
-
257
+ nmcli c a type bridge-slave con-name eth0 ifname eth0 master br0 autoconnect yes
258
+
251
-
259
+ nmcli c
260
+
252
-
261
+ cp -p /etc/sysconfig/network-scripts/ifcfg-* /mnt/sysimage/etc/sysconfig/network-scripts/
262
+
263
+
264
+
253
- echo '/mnt/sysimage/ ==='
265
+ # /usr/bin/chvt 1
266
+
254
-
267
+ %end
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ # Post script
276
+
277
+ %post --log=/root/ks-post.log
278
+
279
+ # %post
280
+
281
+ # exec < /dev/tty3 | tee -a /root/ks-post.log > /dev/tty3
282
+
283
+ # /usr/bin/chvt 3
284
+
285
+ # set -x
286
+
287
+ echo "################################"
288
+
289
+ echo "# Running Post Configuration #"
290
+
291
+ echo "################################"
292
+
293
+
294
+
295
+ # Save post script log
296
+
297
+ cat << "EOF" > /root/ks-pre.log
298
+
299
+ %include /tmp/ks-pre.log
300
+
301
+ EOF
302
+
303
+
304
+
305
+ # Delete default nic
306
+
255
- ls -al /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
307
+ ls -al /etc/sysconfig/network-scripts/
308
+
309
+ find /etc/sysconfig/network-scripts/ -type f -name 'ifcfg-*' | grep -v -e lo$ -e br0$ -e eth0$ | xargs rm -f
310
+
311
+ ls -al /etc/sysconfig/network-scripts/
312
+
313
+
314
+
315
+ # Set shellscript
316
+
317
+ # =============================================================================================================================
318
+
319
+ cat << 'EOS' > /root/firstboot.sh
320
+
321
+ #/bin/bash
322
+
323
+ set -x
324
+
325
+
326
+
327
+ limit=300
328
+
329
+ for i in $(seq 1 $limit); do echo -n "${i} @ $(date '+%Y-%m-%d %H:%M:%S,%3N')" ; ping -c3 -i0.5 10.10.10.1 > /dev/null 2>&1 && break ; sleep 0.3s ; done
330
+
331
+ if [ $i -eq $limit ]; then echo 'orz_OTZ @ cannot ping default gateway' ; exit ; fi
332
+
333
+
334
+
335
+ logger -n 10.10.10.100 -t "firstboot.sh[$$]" -p user.info 'script started'
336
+
337
+
338
+
339
+ rm -f $0
340
+
341
+ rm -f /etc/cron.d/firstboot.cron
342
+
343
+
344
+
345
+ for i in 151 152 153 999 ; do
346
+
347
+ ping -c3 10.10.10.$i && continue
348
+
349
+ ip="10.10.10.${i}"
350
+
351
+ break
352
+
353
+ done
354
+
355
+
356
+
357
+ if [ "$ip" = "10.10.10.999" ]; then
358
+
359
+ logger -n 10.10.10.100 -t "firstboot.sh[$$]" -p user.warning "orz_OTZ @ 10.10.10.151-153 is already used"
360
+
361
+ else
362
+
363
+ logger -n 10.10.10.100 -t "firstboot.sh[$$]" -p user.info "ping ${ip} is ok"
364
+
365
+ nmcli c m br0 ipv4.method manual ipv4.address 10.10.10.$i/24 ipv4.gateway 10.10.10.1 ipv4.dns 8.8.8.8
366
+
367
+ nmcli c up br0
368
+
369
+ fi
370
+
371
+ nmcli c
256
372
 
257
373
  ls -al /etc/sysconfig/network-scripts/ifcfg-*
258
374
 
259
- echo '/mnt/sysimage/ ==='
260
-
261
-
262
-
263
- # Set static ip
264
-
265
- nmcli c a type ethernet ifname eth0 con-name eth0
266
-
267
- nmcli c a type bridge con-name br0 ifname br0 autoconnect yes
268
-
269
- nmcli c m br0 bridge.stp no
270
-
271
- for i in 151 152 153 final; do
272
-
273
- test $i = "final" && nmcli c m br0 ipv4.method auto
274
-
275
-
276
-
277
- ping -c1 192.168.1.$i && continue
278
-
279
- nmcli c m br0 ipv4.method manual ipv4.address 192.168.1.$i/24 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8
280
-
281
- break
282
-
283
- done
284
-
285
- nmcli c m eth0 master br0 connection.slave-type bridge
286
-
287
- rm -rf /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
288
-
289
- cp -p /etc/sysconfig/network-scripts/ifcfg-* /mnt/sysimage/etc/sysconfig/network-scripts/
290
-
291
-
292
-
293
- echo '/mnt/sysimage/ ==='
294
-
295
- ls -al /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
296
-
297
- ls -al /etc/sysconfig/network-scripts/ifcfg-*
298
-
299
- echo '/mnt/sysimage/ ==='
300
-
301
-
302
-
303
- echo 'nmcli c ==='
304
-
305
- nmcli c
306
-
307
- echo 'nmcli c ==='
308
-
309
-
375
+
376
+
377
+ logger -n 10.10.10.100 -t "firstboot.sh[$$]" -p user.info "yum update"
378
+
379
+
380
+
381
+ yum update -y
382
+
383
+ yum install -y rsyslog bash-completion vim git rsync
384
+
385
+
386
+
387
+ cat << 'EOF' > /etc/rsyslog.d/pxe.conf
388
+
389
+ *.info;mail.none;authpriv.none;cron.none /var/log/messages
390
+
391
+ authpriv.* /var/log/secure
392
+
393
+ mail.* -/var/log/maillog
394
+
395
+ cron.* /var/log/cron
396
+
397
+ *.emerg :omusrmsg:*
398
+
399
+ uucp,news.crit /var/log/spooler
400
+
401
+ local7.* /var/log/boot.log
402
+
403
+ *.* @10.10.10.100
404
+
405
+ EOF
406
+
407
+
408
+
409
+ mkdir -p /root/git
410
+
411
+ cd /root/git/
412
+
413
+ git clone https://github.com/teityura/dotfiles.git
414
+
415
+ cd dotfiles/
416
+
417
+ rsync -av ./. /root/ --exclude .git/
418
+
419
+ lvcreate -s -n lv_root_01_deployed vg1/lv_root
420
+
421
+
422
+
423
+ yum install -y epel-release
424
+
425
+ yum install -y sl
426
+
427
+ export TERM=xterm
428
+
429
+ (sl ; clear ; echo 'Please enter login user, password ! q-(-_-)-p') > /dev/tty1 &
430
+
431
+
432
+
433
+ logger -n 10.10.10.100 -t "firstboot.sh[$$]" -p user.info 'script ended'
434
+
435
+ exec $SHELL --login
436
+
437
+ EOS
438
+
439
+ # =============================================================================================================================
440
+
441
+
442
+
443
+ # Set cron
444
+
445
+ cat << 'EOF' > /etc/cron.d/firstboot.cron
446
+
447
+ SHELL=/bin/bash
448
+
449
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin
450
+
451
+ MAILTO=root
452
+
453
+ HOME=/root
454
+
455
+ @reboot root bash firstboot.sh > /root/firstboot-sh.log 2>&1
456
+
457
+ EOF
458
+
459
+
460
+
461
+ # /usr/bin/chvt 1
310
462
 
311
463
  %end
312
464
 
313
-
314
-
315
- # Post script 2
316
-
317
- %post --log=/root/post2-ks.log
318
-
319
- # Setup and snapshot
320
-
321
- yum update -y
322
-
323
- yum install -y bash-completion vim git rsync
324
-
325
- mkdir -p /root/git
326
-
327
- cd /root/git/
328
-
329
- git clone https://github.com/teityura/dotfiles.git
330
-
331
- cd dotfiles/
332
-
333
- rsync -av ./. /root/ --exclude .git/
334
-
335
- lvcreate -s -n lv_root_01_deployed vg1/lv_root
336
-
337
- %end
338
-
339
-
340
-
341
- EOF
465
+ EOC
342
466
 
343
467
  ```
344
-
345
-
346
-
347
- ### ログ
348
-
349
- ```
350
-
351
- [root@localhost ~]# less post1-ks.log
352
-
353
- nmcli c ===
354
-
355
- NAME UUID TYPE DEVICE
356
-
357
- eno1 6f2660f6-89df-4a19-9b6e-58d2d8b0bdb6 ethernet eno1
358
-
359
- nmcli c ===
360
-
361
- /mnt/sysimage/ ===
362
-
363
- -rw-r--r--. 1 root root 164 Oct 1 15:06 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eno1
364
-
365
- -rw-r--r--. 1 root root 164 Oct 1 15:04 /etc/sysconfig/network-scripts/ifcfg-eno1
366
-
367
- /mnt/sysimage/ ===
368
-
369
- Connection 'eth0' (cbabcac8-b269-486b-82ad-2258e00f4737) successfully added.
370
-
371
- Connection 'br0' (5568f601-6347-4eab-a9d1-ebfe5911d463) successfully added.
372
-
373
- PING 192.168.1.151 (192.168.1.151) 56(84) bytes of data.
374
-
375
- From 192.168.1.59 icmp_seq=1 Destination Host Unreachable
376
-
377
-
378
-
379
- --- 192.168.1.151 ping statistics ---
380
-
381
- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
382
-
383
-
384
-
385
- /mnt/sysimage/ ===
386
-
387
- -rw-r--r--. 1 root root 345 Oct 1 15:07 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-br0
388
-
389
- -rw-r--r--. 1 root root 164 Oct 1 15:04 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eno1
390
-
391
- -rw-r--r--. 1 root root 169 Oct 1 15:07 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eth0
392
-
393
- -rw-r--r--. 1 root root 345 Oct 1 15:07 /etc/sysconfig/network-scripts/ifcfg-br0
394
-
395
- -rw-r--r--. 1 root root 164 Oct 1 15:04 /etc/sysconfig/network-scripts/ifcfg-eno1
396
-
397
- -rw-r--r--. 1 root root 169 Oct 1 15:07 /etc/sysconfig/network-scripts/ifcfg-eth0
398
-
399
- /mnt/sysimage/ ===
400
-
401
- nmcli c ===
402
-
403
- NAME UUID TYPE DEVICE
404
-
405
- br0 5568f601-6347-4eab-a9d1-ebfe5911d463 bridge br0
406
-
407
- eno1 6f2660f6-89df-4a19-9b6e-58d2d8b0bdb6 ethernet eno1
408
-
409
- eth0 cbabcac8-b269-486b-82ad-2258e00f4737 ethernet --
410
-
411
- nmcli c ===
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
- [root@localhost ~]# less post2-ks.log
420
-
421
- CentOS-8 - AppStream 9.1 MB/s | 5.8 MB 00:00
422
-
423
- CentOS-8 - Base 3.0 MB/s | 2.2 MB 00:00
424
-
425
- CentOS-8 - Extras 17 kB/s | 8.1 kB 00:00
426
-
427
- Dependencies resolved.
428
-
429
- ======================================================================================
430
-
431
- Package Arch Version Repo Size
432
-
433
- ======================================================================================
434
-
435
- Installing:
436
-
437
- kernel x86_64 4.18.0-193.19.1.el8_2 BaseOS 2.8 M
438
-
439
- (略)
440
-
441
- Complete!
442
-
443
- (略)
444
-
445
- ================================================================================
446
-
447
- Package Arch Version Repository Size
448
-
449
- ================================================================================
450
-
451
- Installing:
452
-
453
- git x86_64 2.18.4-2.el8_2 AppStream 186 kg
454
-
455
- (略)
456
-
457
- Complete!
458
-
459
- Cloning into 'dotfiles'...
460
-
461
- sending incremental file list
462
-
463
- ./
464
-
465
- .bash_logout
466
-
467
- sent 17,668 bytes received 233 bytes 35,802.00 bytes/sec
468
-
469
- total size is 16,830 speedup is 0.94
470
-
471
- WARNING: Sum of all thin volume sizes (1.12 TiB) exceeds the size of thin pool vg1/pool1 and the size of whole volume group (930.82 GiB).
472
-
473
- WARNING: You have not turned on protection against thin pools running out of space.
474
-
475
- WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
476
-
477
- Logical volume "lv_root_01_deployed" created.
478
-
479
- # ログここで終わり
480
-
481
- ```

7

修正

2020/10/04 01:36

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  [192.168.1.151, 192.168.1.152, 192.168.1.153] のうち、
6
6
 
7
- 使用されてないIPを設定するように、postスクリプト等を設定したい。
7
+ 使用されてないIPを設定するように、postスクリプト等を設定したいです
8
-
8
+
9
- (インストールするOSはCentOS8.2 す)
9
+ (インストールするOSは CentOS8.2 になります)
10
10
 
11
11
 
12
12
 
@@ -32,14 +32,14 @@
32
32
 
33
33
  標示させず、待たずにすむようにしたいです。
34
34
 
35
+ **->postスクリプトを2回書いてることで、表示されているようです**
36
+
35
37
 
36
38
 
37
39
  # 表示されているメッセージについて
38
40
 
39
41
  kickstart の post script を書いてから、標示されるようになりました。
40
42
 
41
- **->postスクリプトを2回書いてることで、表示されているようです**
42
-
43
43
  ![表示されてるメッセージ](e5a280017f3c7ca98cc3ba4eb8a98c2c.jpeg)
44
44
 
45
45
 

6

ログ追加, 質問追加

2020/10/01 17:09

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,25 @@
1
+ # やりたいこと
2
+
3
+ PXEBoot, kickstart で OSインストールする際、
4
+
5
+ [192.168.1.151, 192.168.1.152, 192.168.1.153] のうち、
6
+
7
+ 使用されてないIPを設定するように、postスクリプト等を設定したい。
8
+
9
+ (インストールするOSはCentOS8.2 です)
10
+
11
+
12
+
13
+ kickstart で network を 使わず nmcli を使っているのは、
14
+
15
+ ・スクリプトで割り当てる際に便利そう
16
+
17
+ ・今後、VLAN等ややこしい設定をする可能性がある
18
+
19
+ という理由からです。
20
+
21
+
22
+
1
23
  # 困っていること
2
24
 
3
25
  A stop job is running for Anaconda と表示され、1分30秒待たされます。
@@ -12,22 +34,42 @@
12
34
 
13
35
 
14
36
 
15
- 環境は CentOS8.2 です
16
-
17
-
18
-
19
-
20
-
21
37
  # 表示されているメッセージについて
22
38
 
23
- kickstart の post script を書いてから
39
+ kickstart の post script を書いてから、標示されるようになりました。
24
-
40
+
25
- 示されるようになりました。
41
+ **->postスクリプトを2回書いてることで、表示されているようです**
26
42
 
27
43
  ![表示されてるメッセージ](e5a280017f3c7ca98cc3ba4eb8a98c2c.jpeg)
28
44
 
29
45
 
30
46
 
47
+ # 困っていること2
48
+
49
+ nmcliでネットワーク設定をする場合、--nochroot 環境で nmcliを実行してから、
50
+
51
+ cp -p /etc/sysconfig/network-scripts/ifcfg-* /mnt/sysimage/etc/sysconfig/network-scripts/
52
+
53
+ する必要があるみたいで、2回 post を書いています。
54
+
55
+
56
+
57
+ # 試してみたこと
58
+
59
+ kickstart の post 実行中に
60
+
61
+ ls -al /mnt/sysimage/bin/bash で bash があったので、
62
+
63
+ yum update -y する前に
64
+
65
+ chroot /mnt/sysimage/ したのですが、
66
+
67
+ yum update が実行せずに、lvcreate のみ実行されるような動きをしており、
68
+
69
+ どのように設定するかで悩んでいます。
70
+
71
+
72
+
31
73
  # Kickstartの内容について
32
74
 
33
75
  kickstart は 以下のような内容になっています。
@@ -196,7 +238,7 @@
196
238
 
197
239
  # Post script 1
198
240
 
199
- %post --nochroot --log=/mnt/sysimage/root/post-ks.log
241
+ %post --nochroot --log=/mnt/sysimage/root/post1-ks.log
200
242
 
201
243
 
202
244
 
@@ -272,7 +314,7 @@
272
314
 
273
315
  # Post script 2
274
316
 
275
- %post --log=/root/post-ks.log
317
+ %post --log=/root/post2-ks.log
276
318
 
277
319
  # Setup and snapshot
278
320
 
@@ -298,8 +340,142 @@
298
340
 
299
341
  EOF
300
342
 
301
-
302
-
303
-
304
-
305
343
  ```
344
+
345
+
346
+
347
+ ### ログ
348
+
349
+ ```
350
+
351
+ [root@localhost ~]# less post1-ks.log
352
+
353
+ nmcli c ===
354
+
355
+ NAME UUID TYPE DEVICE
356
+
357
+ eno1 6f2660f6-89df-4a19-9b6e-58d2d8b0bdb6 ethernet eno1
358
+
359
+ nmcli c ===
360
+
361
+ /mnt/sysimage/ ===
362
+
363
+ -rw-r--r--. 1 root root 164 Oct 1 15:06 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eno1
364
+
365
+ -rw-r--r--. 1 root root 164 Oct 1 15:04 /etc/sysconfig/network-scripts/ifcfg-eno1
366
+
367
+ /mnt/sysimage/ ===
368
+
369
+ Connection 'eth0' (cbabcac8-b269-486b-82ad-2258e00f4737) successfully added.
370
+
371
+ Connection 'br0' (5568f601-6347-4eab-a9d1-ebfe5911d463) successfully added.
372
+
373
+ PING 192.168.1.151 (192.168.1.151) 56(84) bytes of data.
374
+
375
+ From 192.168.1.59 icmp_seq=1 Destination Host Unreachable
376
+
377
+
378
+
379
+ --- 192.168.1.151 ping statistics ---
380
+
381
+ 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
382
+
383
+
384
+
385
+ /mnt/sysimage/ ===
386
+
387
+ -rw-r--r--. 1 root root 345 Oct 1 15:07 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-br0
388
+
389
+ -rw-r--r--. 1 root root 164 Oct 1 15:04 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eno1
390
+
391
+ -rw-r--r--. 1 root root 169 Oct 1 15:07 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eth0
392
+
393
+ -rw-r--r--. 1 root root 345 Oct 1 15:07 /etc/sysconfig/network-scripts/ifcfg-br0
394
+
395
+ -rw-r--r--. 1 root root 164 Oct 1 15:04 /etc/sysconfig/network-scripts/ifcfg-eno1
396
+
397
+ -rw-r--r--. 1 root root 169 Oct 1 15:07 /etc/sysconfig/network-scripts/ifcfg-eth0
398
+
399
+ /mnt/sysimage/ ===
400
+
401
+ nmcli c ===
402
+
403
+ NAME UUID TYPE DEVICE
404
+
405
+ br0 5568f601-6347-4eab-a9d1-ebfe5911d463 bridge br0
406
+
407
+ eno1 6f2660f6-89df-4a19-9b6e-58d2d8b0bdb6 ethernet eno1
408
+
409
+ eth0 cbabcac8-b269-486b-82ad-2258e00f4737 ethernet --
410
+
411
+ nmcli c ===
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+ [root@localhost ~]# less post2-ks.log
420
+
421
+ CentOS-8 - AppStream 9.1 MB/s | 5.8 MB 00:00
422
+
423
+ CentOS-8 - Base 3.0 MB/s | 2.2 MB 00:00
424
+
425
+ CentOS-8 - Extras 17 kB/s | 8.1 kB 00:00
426
+
427
+ Dependencies resolved.
428
+
429
+ ======================================================================================
430
+
431
+ Package Arch Version Repo Size
432
+
433
+ ======================================================================================
434
+
435
+ Installing:
436
+
437
+ kernel x86_64 4.18.0-193.19.1.el8_2 BaseOS 2.8 M
438
+
439
+ (略)
440
+
441
+ Complete!
442
+
443
+ (略)
444
+
445
+ ================================================================================
446
+
447
+ Package Arch Version Repository Size
448
+
449
+ ================================================================================
450
+
451
+ Installing:
452
+
453
+ git x86_64 2.18.4-2.el8_2 AppStream 186 kg
454
+
455
+ (略)
456
+
457
+ Complete!
458
+
459
+ Cloning into 'dotfiles'...
460
+
461
+ sending incremental file list
462
+
463
+ ./
464
+
465
+ .bash_logout
466
+
467
+ sent 17,668 bytes received 233 bytes 35,802.00 bytes/sec
468
+
469
+ total size is 16,830 speedup is 0.94
470
+
471
+ WARNING: Sum of all thin volume sizes (1.12 TiB) exceeds the size of thin pool vg1/pool1 and the size of whole volume group (930.82 GiB).
472
+
473
+ WARNING: You have not turned on protection against thin pools running out of space.
474
+
475
+ WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
476
+
477
+ Logical volume "lv_root_01_deployed" created.
478
+
479
+ # ログここで終わり
480
+
481
+ ```

5

kickstart 修正

2020/10/01 17:07

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -196,7 +196,7 @@
196
196
 
197
197
  # Post script 1
198
198
 
199
- %post --nochroot --log=/root/post1-ks.log
199
+ %post --nochroot --log=/mnt/sysimage/root/post-ks.log
200
200
 
201
201
 
202
202
 
@@ -272,9 +272,7 @@
272
272
 
273
273
  # Post script 2
274
274
 
275
- %post --log=/root/post2-ks.log
275
+ %post --log=/root/post-ks.log
276
-
277
-
278
276
 
279
277
  # Setup and snapshot
280
278
 
@@ -302,4 +300,6 @@
302
300
 
303
301
 
304
302
 
303
+
304
+
305
305
  ```

4

kickstart 修正

2020/09/29 21:51

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,7 @@
92
92
 
93
93
  # Root password
94
94
 
95
- rootpw --iscrypted $6$0f5yPKYQO3ggj2vB$hXU8VDtEGAeyU/foHBH9PYTW7imzuLFXGpBSCDbGm0lYLOumZ7bb.Fj8fUYKbmLOMdaCX9hbXr4gf74lDGAzk1
95
+ rootpw --iscrypted passpass
96
96
 
97
97
 
98
98
 

3

kickstart 修正

2020/09/29 21:42

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,7 @@
92
92
 
93
93
  # Root password
94
94
 
95
- rootpw --iscrypted passpass
95
+ rootpw --iscrypted $6$0f5yPKYQO3ggj2vB$hXU8VDtEGAeyU/foHBH9PYTW7imzuLFXGpBSCDbGm0lYLOumZ7bb.Fj8fUYKbmLOMdaCX9hbXr4gf74lDGAzk1
96
96
 
97
97
 
98
98
 
@@ -194,7 +194,29 @@
194
194
 
195
195
 
196
196
 
197
+ # Post script 1
198
+
197
- %post --log=/root/post-ks.log
199
+ %post --nochroot --log=/root/post1-ks.log
200
+
201
+
202
+
203
+ echo 'nmcli c ==='
204
+
205
+ nmcli c
206
+
207
+ echo 'nmcli c ==='
208
+
209
+
210
+
211
+ echo '/mnt/sysimage/ ==='
212
+
213
+ ls -al /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
214
+
215
+ ls -al /etc/sysconfig/network-scripts/ifcfg-*
216
+
217
+ echo '/mnt/sysimage/ ==='
218
+
219
+
198
220
 
199
221
  # Set static ip
200
222
 
@@ -204,11 +226,15 @@
204
226
 
205
227
  nmcli c m br0 bridge.stp no
206
228
 
207
- for i in 151 152 153; do
229
+ for i in 151 152 153 final; do
230
+
231
+ test $i = "final" && nmcli c m br0 ipv4.method auto
232
+
233
+
208
234
 
209
235
  ping -c1 192.168.1.$i && continue
210
236
 
211
- nmcli c m br0 ipv4.method manual ipv4.address 192.168.1.$i/16 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8
237
+ nmcli c m br0 ipv4.method manual ipv4.address 192.168.1.$i/24 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8
212
238
 
213
239
  break
214
240
 
@@ -216,6 +242,38 @@
216
242
 
217
243
  nmcli c m eth0 master br0 connection.slave-type bridge
218
244
 
245
+ rm -rf /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
246
+
247
+ cp -p /etc/sysconfig/network-scripts/ifcfg-* /mnt/sysimage/etc/sysconfig/network-scripts/
248
+
249
+
250
+
251
+ echo '/mnt/sysimage/ ==='
252
+
253
+ ls -al /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
254
+
255
+ ls -al /etc/sysconfig/network-scripts/ifcfg-*
256
+
257
+ echo '/mnt/sysimage/ ==='
258
+
259
+
260
+
261
+ echo 'nmcli c ==='
262
+
263
+ nmcli c
264
+
265
+ echo 'nmcli c ==='
266
+
267
+
268
+
269
+ %end
270
+
271
+
272
+
273
+ # Post script 2
274
+
275
+ %post --log=/root/post2-ks.log
276
+
219
277
 
220
278
 
221
279
  # Setup and snapshot
@@ -244,6 +302,4 @@
244
302
 
245
303
 
246
304
 
247
-
248
-
249
305
  ```

2

kickstart 修正

2020/09/29 21:41

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,12 @@
12
12
 
13
13
 
14
14
 
15
+ 環境は CentOS8.2 です
16
+
17
+
18
+
19
+
20
+
15
21
  # 表示されているメッセージについて
16
22
 
17
23
  kickstart の post script を書いてから
@@ -192,14 +198,6 @@
192
198
 
193
199
  # Set static ip
194
200
 
195
- echo 'nmcli c ==='
196
-
197
- nmcli c
198
-
199
- echo 'nmcli c ==='
200
-
201
-
202
-
203
201
  nmcli c a type ethernet ifname eth0 con-name eth0
204
202
 
205
203
  nmcli c a type bridge con-name br0 ifname br0 autoconnect yes
@@ -220,16 +218,6 @@
220
218
 
221
219
 
222
220
 
223
- echo '/mnt/sysimage/ ==='
224
-
225
- ls -al /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-*
226
-
227
- ls -al /etc/sysconfig/network-scripts/ifcfg-*
228
-
229
- echo '/mnt/sysimage/ ==='
230
-
231
-
232
-
233
221
  # Setup and snapshot
234
222
 
235
223
  yum update -y

1

kickstart 修正

2020/09/29 20:52

投稿

teityura
teityura

スコア84

test CHANGED
File without changes
test CHANGED
@@ -204,24 +204,20 @@
204
204
 
205
205
  nmcli c a type bridge con-name br0 ifname br0 autoconnect yes
206
206
 
207
- nmcli c m br0 bridge.stp no ipv4.method manual
207
+ nmcli c m br0 bridge.stp no
208
+
208
-
209
+ for i in 151 152 153; do
210
+
211
+ ping -c1 192.168.1.$i && continue
212
+
209
- nmcli c m br0 ipv4.address 192.168.1.$i/16 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1
213
+ nmcli c m br0 ipv4.method manual ipv4.address 192.168.1.$i/16 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8
214
+
215
+ break
216
+
217
+ done
210
218
 
211
219
  nmcli c m eth0 master br0 connection.slave-type bridge
212
220
 
213
- for i in 151 152 153; do
214
-
215
- ping -c1 192.168.1.$i && continue
216
-
217
- nmcli c m br0 ipv4.address 192.168.1.$i/16 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1
218
-
219
- break
220
-
221
- done
222
-
223
- nmcli c m eth0 master br0 connection.slave-type bridge
224
-
225
221
 
226
222
 
227
223
  echo '/mnt/sysimage/ ==='
@@ -236,8 +232,6 @@
236
232
 
237
233
  # Setup and snapshot
238
234
 
239
- %post --log=/root/post-ks.log
240
-
241
235
  yum update -y
242
236
 
243
237
  yum install -y bash-completion vim git rsync
@@ -262,4 +256,6 @@
262
256
 
263
257
 
264
258
 
259
+
260
+
265
261
  ```