core: 添加 cloud-init 配置
This commit is contained in:
parent
771adae569
commit
0c6ec371ba
21
nocloud.yaml
Normal file
21
nocloud.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#cloud-config
|
||||||
|
datasource_list: [NoCloud]
|
||||||
|
disable_root: false
|
||||||
|
ssh_pwauth: true
|
||||||
|
users:
|
||||||
|
- name: root
|
||||||
|
lock_passwd: false
|
||||||
|
chpasswd:
|
||||||
|
expire: false
|
||||||
|
# 20.04 arm 需要
|
||||||
|
list: |
|
||||||
|
root:123@@@
|
||||||
|
users:
|
||||||
|
- name: root
|
||||||
|
password: 123@@@
|
||||||
|
type: text
|
||||||
|
runcmd:
|
||||||
|
# arch 没有 /etc/ssh/sshd_config.d/ 文件夹
|
||||||
|
- echo "PermitRootLogin yes" >/etc/ssh/sshd_config.d/01-permitrootlogin.conf || echo "PermitRootLogin yes" >>/etc/ssh/sshd_config
|
||||||
|
- systemctl restart sshd
|
||||||
|
- echo -e '\nDone' >/dev/tty0
|
8
trans.sh
8
trans.sh
@ -379,7 +379,7 @@ fi
|
|||||||
update_part /dev/$xda
|
update_part /dev/$xda
|
||||||
|
|
||||||
if is_use_cloud_image; then
|
if is_use_cloud_image; then
|
||||||
apk add qemu-img
|
apk add qemu-img lsblk
|
||||||
|
|
||||||
mkdir -p /installer
|
mkdir -p /installer
|
||||||
mount /dev/disk/by-label/installer /installer
|
mount /dev/disk/by-label/installer /installer
|
||||||
@ -423,6 +423,12 @@ if is_use_cloud_image; then
|
|||||||
umount /installer/
|
umount /installer/
|
||||||
dd if=/first-1M of=/dev/$xda
|
dd if=/first-1M of=/dev/$xda
|
||||||
update_part /dev/$xda
|
update_part /dev/$xda
|
||||||
|
|
||||||
|
# 找到系统分区,也就是最大的分区
|
||||||
|
os_part=$(lsblk /dev/sda*[0-9] --sort SIZE -o NAME | tail -1)
|
||||||
|
mkdir -p /os
|
||||||
|
mount /dev/$os_part /os
|
||||||
|
download $confhome/nocloud.yaml /os/etc/cloud/cloud.cfg.d/99_nocloud.cfg
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
# 挂载主分区
|
# 挂载主分区
|
||||||
|
Loading…
Reference in New Issue
Block a user