1

I'm trying to create partitions in Vagrant vm and to map them to an ansible host file but the play that i'm running is not recognizing them.

Here's the Vagrantfile configuration:

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'
    libvirt.storage :file, :size => '20G', :device => '/dev/vdf', :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

and the host file where i have configured the disk:

disk:
  - name: swap
    device: /dev/vdb
    partnr: 1
    label: gpt
    fstype: linux-swap
    mkfs: swap
  - name: var
    device: /dev/vdc
    partnr: 1
    label: gpt
    fstype: ext4
    mkfs: ext4
    fsopt: -m0
  - name: opt
    device: /dev/vdd
    partnr: 1
    label: gpt
    fstype: ext4
    mkfs: ext4
    fsopt: -m0

0

You must log in to answer this question.

Browse other questions tagged .