stancel.create-digitalocean-droplet

Create DigitalOcean Droplet

=========

This is a guide to create a DigitalOcean droplet and add a DNS entry for it. This will allow access using a specific URL (defined by the create_digitalocean_droplet_server_fqdn variable). The newly created server will also be included in an Ansible group named "new_server," which you can use for further configuration in future tasks.

Requirements

To use this role, you need:

  • A DigitalOcean account
  • Your DigitalOcean API Key saved in an environment variable called "DO_API_TOKEN"
  • The nameservers for your main domain (pointing to server_fqdn) must be set to DigitalOcean's nameservers
  • Your SSH keys uploaded to your DigitalOcean account, and their fingerprints (MD5 hashed values) saved in the variable list (ssh_keys)

Role Variables

  • Droplet Hostname: Set the name for your DigitalOcean droplet. This name will appear both in your droplets list and as the Linux VPS hostname.

    create_digitalocean_droplet_host_name: "my-hostname-here"
    
  • Domain Name: Specify the domain name you want to link to your droplet.

    create_digitalocean_droplet_server_fqdn: "mysubdomain.mydomain.com"
    
  • API Token: Save your DigitalOcean API token in this variable.

    create_digitalocean_droplet_do_token: "{{ lookup('env', 'DO_API_TOKEN') }}"
    
  • SSH Key Fingerprints: List the fingerprints of any SSH keys you've uploaded. These will be used to access the droplet.

    create_digitalocean_droplet_ssh_key_ids:
      - "72:aa:ae:3a:62:4d:b4:3d:6a:c5:0f:17:f8:1f:ad:d2"
      - "e4:1d:b2:d1:e1:42:c7:5c:b6:71:75:2b:f4:8d:bf:c7"
    
  • Droplet Size: Choose the size of your droplet (default is 1GB).

    create_digitalocean_droplet_droplet_size: "1gb"
    
  • Droplet Image: Select the base image for your droplet. The default is Ubuntu 16.04 LTS.

    create_digitalocean_droplet_droplet_image: "ubuntu-16-04-x64"
    
  • Data Center Region: Specify where to create your droplet (default is "nyc1").

    create_digitalocean_droplet_region: "nyc1"
    

Dependencies

None

Example Playbook

Here’s how to use this role in a playbook:

- hosts: localhost
  ansible_connection: local
  ansible_python_interpreter: python
  vars_files:
    - vars/main.yml
  roles:
    - { role: stancel.create-digitalocean-droplet }

Or you can define the variables directly in the playbook:

- hosts: localhost
  ansible_connection: local
  ansible_python_interpreter: python
  vars:
    create_digitalocean_droplet_host_name: "my-hostname-here"
    create_digitalocean_droplet_server_fqdn: "mysubdomain.mydomain.com"
    create_digitalocean_droplet_do_token: "{{ lookup('env', 'DO_API_TOKEN') }}"
    create_digitalocean_droplet_ssh_key_ids:
      - "72:aa:ae:3a:62:4d:b4:3d:6a:c5:0f:17:f8:1f:ad:d2"
    create_digitalocean_droplet_droplet_size: "1gb"
    create_digitalocean_droplet_droplet_image: "ubuntu-16-04-x64"
    create_digitalocean_droplet_region: "nyc1"
  roles:
    - { role: stancel.create-digitalocean-droplet }

License

BSD

Author Information

Brad Stancel

Informazioni sul progetto

Role for creating a DigitalOcean droplet that can then be provisioned accordingly.

Installa
ansible-galaxy install stancel.create-digitalocean-droplet
Licenza
Unknown
Download
222
Proprietario