我已经完成了所有工作,但我想知道是否有更好的方法?用这种方法进行微小更改似乎非常困难。我在这里使用 vsphere-iso 配置器,但如果有意义的话,我也可以使用模板。我想避免额外的步骤。
理想情况下,我想用 Ansible 来做到这一点,但我不知道最好的方法是什么。
我使用 Packer、Ansible 和 SHell 构建映像。使用 Terraform 和 Ansible 进行配置。所以请给我一些建议,告诉我哪里是执行此操作的最佳位置。
我正在尝试在 Ubuntu22 中设置 LVM 分区。对于 EL,我只需使用 Kickstart 即可完成此操作。
在我的 ./http/user-data 中我有类似这样的内容
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
config:
- ptable: gpt
path: /dev/sda
wipe: superblock-recursive
preserve: false
name: ''
grub_device: true
id: disk-sda
type: disk
- device: disk-sda
size: 1048576
flag: bios_grub
number: 1
preserve: false
grub_device: false
offset: 1048576
path: /dev/sda1
id: partition-0
type: partition
- device: disk-sda
size: 2147483648
wipe: superblock
number: 2
preserve: false
grub_device: false
offset: 2097152
path: /dev/sda2
id: partition-1
type: partition
- fstype: ext4
volume: partition-1
preserve: false
id: format-0
type: format
- device: disk-sda
size: 105223553024
wipe: superblock
number: 3
preserve: false
grub_device: false
offset: 2149580800
path: /dev/sda3
id: partition-2
type: partition
- name: ubuntu-vg
devices:
- partition-2
preserve: false
id: lvm_volgroup-0
type: lvm_volgroup
- name: root-lv
volgroup: lvm_volgroup-0
size: 21474836480B
wipe: superblock
preserve: false
path: /dev/ubuntu-vg/root-lv
id: lvm_partition-0
type: lvm_partition
- fstype: ext4
volume: lvm_partition-0
preserve: false
id: format-2
type: format
- path: /
device: format-2
id: mount-2
type: mount
- name: tmp
volgroup: lvm_volgroup-0
size: 5368709120B
wipe: superblock
preserve: false
path: /dev/ubuntu-vg/tmp
id: lvm_partition-1
type: lvm_partition
- fstype: ext4
volume: lvm_partition-1
preserve: false
id: format-3
type: format
- path: /tmp
device: format-3
id: mount-3
type: mount
- name: home-lv
volgroup: lvm_volgroup-0
size: 10737418240B
wipe: superblock
preserve: false
path: /dev/ubuntu-vg/home-lv
id: lvm_partition-2
type: lvm_partition
- fstype: ext4
volume: lvm_partition-2
preserve: false
id: format-4
type: format
- path: /home
device: format-4
id: mount-4
type: mount
- name: var-lv
volgroup: lvm_volgroup-0
size: 21474836480B
wipe: superblock
preserve: false
path: /dev/ubuntu-vg/var-lv
id: lvm_partition-3
type: lvm_partition
- fstype: ext4
volume: lvm_partition-3
preserve: false
id: format-5
type: format
- path: /var
device: format-5
id: mount-5
type: mount
- name: log-lv
volgroup: lvm_volgroup-0
size: 10737418240B
wipe: superblock
preserve: false
path: /dev/ubuntu-vg/log-lv
id: lvm_partition-4
type: lvm_partition
- fstype: ext4
volume: lvm_partition-4
preserve: false
id: format-6
type: format
- path: /var/log
device: format-6
id: mount-6
type: mount
- path: /boot
device: format-0
id: mount-0
type: mount
显然,这不是最好的修改方法。有没有更好的方法来指定分区布局?