terminal-labs / rambo

A Provider Agnostic Provisioning Framework
Other
24 stars 5 forks source link

Mount block storage on digitalocean #72

Open nixjdm opened 7 years ago

verhulstm commented 7 years ago

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

verhulstm commented 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.

verhulstm commented 7 years ago

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.

verhulstm commented 7 years ago

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"

verhulstm commented 7 years ago

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.

verhulstm commented 7 years ago

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

nixjdm commented 6 years ago

This might be able to be done with the vagrant plugin. I.e. with the provider.volumes param.