Question

How do I create a smallest droplet which costs $5/mo through ansible?

I use digital ocean droplet module within my playbook

e.g.

- name: Create droplet
  digital_ocean_droplet:
    state: present
    name: "test-droplet"
    region: "fra1"
    size: "1gb"
#    disk: "25"
    image: "ubuntu-20-04-x64"
    unique_name: yes
    oauth_token: "{{ do_api_token }}"

After running it, I have got a droplet with 1 GB / 1 CPU and 30 GB SSD disk which costs $10/mo. Actually, I don’t see an option to specify disk size in https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet

Is it possible to have the cheapest one created by ansible’s playbook?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hello, @skierat

Could you please try with using the following as size:

size: "s-1vcpu-1gb"

This should create the droplet with 1 CPU / 1 GB Memory / 25 GB Disk

If you’re using the API this will be the same as in the example listed in:

https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582" -d '{"name":"example.com","region":"nyc3","size":"s-1vcpu-1gb","image":"ubuntu-16-04-x64","ssh_keys":[107149],"backups":false,"ipv6":true,"user_data":null,"private_networking":null,"volumes": null,"tags":["web"]}' "https://api.digitalocean.com/v2/droplets"

If you’re using doctl :

doctl compute droplet create sammy-test --size s-1vcpu-1gb --image ubuntu-18-04-x64 --region fra1 --ssh-keys 11:11:11:11:1:1:11:11:11:11:11:11:11:11:11:1

Where you need to replace the the key with your actual key.

Hope this helps!

Let me know how it goes

Regards, Alex

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.