到目前为止,我已经尝试了所有方法,但没有结果。我有一个在机器上创建分区的 ansible 角色。我试图在虚拟机上设置分区,但我做不到(我使用 libvirt 作为提供程序)。
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.storage :file, :size => '20G', :device => '/dev/vdb', :bus => 'scsi'
libvirt.storage :file, :size => '20G', :device => '/dev/vdc', :bus => 'scsi'
libvirt.storage :file, :size => '20G', :device => '/dev/vdd', :bus => 'scsi'
end
config.vm.box = "roboxes/centos9s"
config.vm.provision "shell" do |s|
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
s.inline = <<-SHELL
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
SHELL
end