Open nixjdm opened 7 years ago
I think we should use grains to inform a vm what extra blocks disk to use. that way it will be easier to attach block storage on all the providers.
we could make a salt state that reads grains and makes the needed api calls to setup the block disk.
the creation of new empty block storage on each "rambo up" can be done in the highstate. the attachment of long term storage blocks with data already in them needs to be done in something like the main vagrantfile.
this command will list the volumes.
curl -X GET -H "Content-Type: application/json" -u "[your api token]:" "https://api.digitalocean.com/v2/volumes?region=nyc1"
all the DO api calls need resource ids, names won't work. we need a system that can parse json and the correlate vms id with their names. look like we need to make a custom salt execution module.
I may have found a bug in DO's api. the attach call reports that it is in-progress forever.
however, attaching the block dev in the gui portal manually does work.
i filed a ticket
This might be able to be done with the vagrant plugin. I.e. with the provider.volumes
param.
the docs on DO work perfectly
https://www.digitalocean.com/community/tutorials/how-to-use-block-storage-on-digitalocean
sudo parted /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 mklabel gpt sudo parted -a opt /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 mkpart primary ext4 0% 100% sudo mkfs.ext4 /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1 sudo mkdir -p /mnt/volume-nyc1-01-part1 echo '/dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1 /mnt/volume-nyc1-01-part1 ext4 defaults,nofail,discard 0 2' | sudo tee -a /etc/fstab sudo mount -a
we could just do the above in salt via cmd.run
or maybe this works https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.disk.html