Skip to content

Instantly share code, notes, and snippets.

@mamercad
Created February 7, 2022 23:32
Show Gist options
  • Save mamercad/b7f35583ae72d943b144c4daebc65936 to your computer and use it in GitHub Desktop.
Save mamercad/b7f35583ae72d943b144c4daebc65936 to your computer and use it in GitHub Desktop.
❯ ansible-playbook -i localhost, -c local droplet.yml -v
Using /Users/mark/.ansible.cfg as config file
PLAY [droplet] *******************************************************************************************************************************************************************
TASK [Create a new Droplet] ******************************************************************************************************************************************************
changed: [localhost] => changed=true
data:
droplet:
backup_ids: []
created_at: '2022-02-07T23:30:18Z'
disk: 50
features:
- monitoring
- droplet_agent
- ipv6
- private_networking
id: 285628781
image:
created_at: '2022-02-01T16:53:57Z'
description: Ubuntu 20.04 x86
distribution: Ubuntu
id: 101111514
min_disk_size: 15
name: 20.04 (LTS) x64
public: true
regions:
- nyc3
- nyc1
- sfo1
- nyc2
- ams2
- sgp1
- lon1
- ams3
- fra1
- tor1
- sfo2
- blr1
- sfo3
size_gigabytes: 0.61
slug: ubuntu-20-04-x64
status: available
tags: []
type: base
kernel: null
locked: false
memory: 2048
name: test-delete-1
networks:
v4:
- gateway: 159.223.144.1
ip_address: 159.223.147.166
netmask: 255.255.240.0
type: public
- gateway: 10.116.0.1
ip_address: 10.116.0.2
netmask: 255.255.240.0
type: private
v6:
- gateway: 2604:a880:400:d0::1
ip_address: 2604:a880:400:d0::1acf:d001
netmask: 64
type: public
next_backup_window: null
region:
available: true
features:
- backups
- ipv6
- metadata
- install_agent
- storage
- image_transfer
name: New York 1
sizes:
- s-1vcpu-1gb
- s-1vcpu-1gb-amd
- s-1vcpu-1gb-intel
- s-1vcpu-2gb
- s-1vcpu-2gb-amd
- s-1vcpu-2gb-intel
- s-2vcpu-2gb
- s-2vcpu-2gb-amd
- s-2vcpu-2gb-intel
- s-2vcpu-4gb
- s-2vcpu-4gb-amd
- s-2vcpu-4gb-intel
- s-4vcpu-8gb
- c-2
- c2-2vcpu-4gb
- s-4vcpu-8gb-amd
- s-4vcpu-8gb-intel
- g-2vcpu-8gb
- gd-2vcpu-8gb
- s-8vcpu-16gb
- m-2vcpu-16gb
- c-4
- c2-4vcpu-8gb
- s-8vcpu-16gb-amd
- s-8vcpu-16gb-intel
- m3-2vcpu-16gb
- g-4vcpu-16gb
- so-2vcpu-16gb
- m6-2vcpu-16gb
- gd-4vcpu-16gb
- so1_5-2vcpu-16gb
- m-4vcpu-32gb
- c-8
- c2-8vcpu-16gb
- m3-4vcpu-32gb
- g-8vcpu-32gb
- so-4vcpu-32gb
- m6-4vcpu-32gb
- gd-8vcpu-32gb
- so1_5-4vcpu-32gb
- m-8vcpu-64gb
- c-16
- c2-16vcpu-32gb
- m3-8vcpu-64gb
- g-16vcpu-64gb
- so-8vcpu-64gb
- m6-8vcpu-64gb
- gd-16vcpu-64gb
- so1_5-8vcpu-64gb
- m-16vcpu-128gb
- c-32
- m3-16vcpu-128gb
- m-24vcpu-192gb
- g-32vcpu-128gb
- so-16vcpu-128gb
- m6-16vcpu-128gb
- gd-32vcpu-128gb
- m3-24vcpu-192gb
- g-40vcpu-160gb
- so1_5-16vcpu-128gb
- m-32vcpu-256gb
- gd-40vcpu-160gb
- so-24vcpu-192gb
- m6-24vcpu-192gb
- m3-32vcpu-256gb
- so1_5-24vcpu-192gb
- so-32vcpu-256gb
- m6-32vcpu-256gb
- so1_5-32vcpu-256gb
slug: nyc1
size:
available: true
description: Basic
disk: 50
memory: 2048
price_hourly: 0.01488
price_monthly: 10.0
regions:
- ams3
- blr1
- fra1
- lon1
- nyc1
- nyc3
- sfo3
- sgp1
- tor1
slug: s-1vcpu-2gb
transfer: 2.0
vcpus: 1
size_slug: s-1vcpu-2gb
snapshot_ids: []
status: active
tags:
- test
vcpus: 1
volume_ids: []
vpc_uuid: 5ebac729-078d-416e-bbfb-31ed6ac6d11a
TASK [Debug] *********************************************************************************************************************************************************************
ok: [localhost] =>
my_droplet:
changed: true
data:
droplet:
backup_ids: []
created_at: '2022-02-07T23:30:18Z'
disk: 50
features:
- monitoring
- droplet_agent
- ipv6
- private_networking
id: 285628781
image:
created_at: '2022-02-01T16:53:57Z'
description: Ubuntu 20.04 x86
distribution: Ubuntu
id: 101111514
min_disk_size: 15
name: 20.04 (LTS) x64
public: true
regions:
- nyc3
- nyc1
- sfo1
- nyc2
- ams2
- sgp1
- lon1
- ams3
- fra1
- tor1
- sfo2
- blr1
- sfo3
size_gigabytes: 0.61
slug: ubuntu-20-04-x64
status: available
tags: []
type: base
kernel: null
locked: false
memory: 2048
name: test-delete-1
networks:
v4:
- gateway: 159.223.144.1
ip_address: 159.223.147.166
netmask: 255.255.240.0
type: public
- gateway: 10.116.0.1
ip_address: 10.116.0.2
netmask: 255.255.240.0
type: private
v6:
- gateway: 2604:a880:400:d0::1
ip_address: 2604:a880:400:d0::1acf:d001
netmask: 64
type: public
next_backup_window: null
region:
available: true
features:
- backups
- ipv6
- metadata
- install_agent
- storage
- image_transfer
name: New York 1
sizes:
- s-1vcpu-1gb
- s-1vcpu-1gb-amd
- s-1vcpu-1gb-intel
- s-1vcpu-2gb
- s-1vcpu-2gb-amd
- s-1vcpu-2gb-intel
- s-2vcpu-2gb
- s-2vcpu-2gb-amd
- s-2vcpu-2gb-intel
- s-2vcpu-4gb
- s-2vcpu-4gb-amd
- s-2vcpu-4gb-intel
- s-4vcpu-8gb
- c-2
- c2-2vcpu-4gb
- s-4vcpu-8gb-amd
- s-4vcpu-8gb-intel
- g-2vcpu-8gb
- gd-2vcpu-8gb
- s-8vcpu-16gb
- m-2vcpu-16gb
- c-4
- c2-4vcpu-8gb
- s-8vcpu-16gb-amd
- s-8vcpu-16gb-intel
- m3-2vcpu-16gb
- g-4vcpu-16gb
- so-2vcpu-16gb
- m6-2vcpu-16gb
- gd-4vcpu-16gb
- so1_5-2vcpu-16gb
- m-4vcpu-32gb
- c-8
- c2-8vcpu-16gb
- m3-4vcpu-32gb
- g-8vcpu-32gb
- so-4vcpu-32gb
- m6-4vcpu-32gb
- gd-8vcpu-32gb
- so1_5-4vcpu-32gb
- m-8vcpu-64gb
- c-16
- c2-16vcpu-32gb
- m3-8vcpu-64gb
- g-16vcpu-64gb
- so-8vcpu-64gb
- m6-8vcpu-64gb
- gd-16vcpu-64gb
- so1_5-8vcpu-64gb
- m-16vcpu-128gb
- c-32
- m3-16vcpu-128gb
- m-24vcpu-192gb
- g-32vcpu-128gb
- so-16vcpu-128gb
- m6-16vcpu-128gb
- gd-32vcpu-128gb
- m3-24vcpu-192gb
- g-40vcpu-160gb
- so1_5-16vcpu-128gb
- m-32vcpu-256gb
- gd-40vcpu-160gb
- so-24vcpu-192gb
- m6-24vcpu-192gb
- m3-32vcpu-256gb
- so1_5-24vcpu-192gb
- so-32vcpu-256gb
- m6-32vcpu-256gb
- so1_5-32vcpu-256gb
slug: nyc1
size:
available: true
description: Basic
disk: 50
memory: 2048
price_hourly: 0.01488
price_monthly: 10.0
regions:
- ams3
- blr1
- fra1
- lon1
- nyc1
- nyc3
- sfo3
- sgp1
- tor1
slug: s-1vcpu-2gb
transfer: 2.0
vcpus: 1
size_slug: s-1vcpu-2gb
snapshot_ids: []
status: active
tags:
- test
vcpus: 1
volume_ids: []
vpc_uuid: 5ebac729-078d-416e-bbfb-31ed6ac6d11a
failed: false
PLAY RECAP ***********************************************************************************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
---
- name: droplet
hosts: localhost
connection: local
gather_facts: false
vars:
droplet_name: test-delete-1
do_oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_KEY') }}"
ssh_key: "{{ lookup('ansible.builtin.env', 'DO_SSH_KEY_ID') }}"
tasks:
- name: Create a new Droplet
community.digitalocean.digital_ocean_droplet:
state: present
name: "{{ droplet_name }}"
unique_name: yes
oauth_token: "{{ do_oauth_token }}"
size_id: s-1vcpu-2gb
region_id: nyc1
image_id: ubuntu-20-04-x64
ipv6: yes
monitoring: yes
ssh_keys: ["{{ ssh_key }}"]
wait_timeout: 300
tags: ['test']
register: my_droplet
- name: Debug
ansible.builtin.debug:
var: my_droplet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment