Git Product home page Git Product logo

ansible-role-do-droplets's Introduction

Build Status License Galaxy

Ansible role: lafarer.do-droplets

Ansible role to create and bootstrap digitalocean droplet(s).

if do_inventory_file is set the created droplets are added to the [digitalocean] section of the inventory file.

During droplet creation, minimal security update is applied:

  • SSH - Key based login, disable root login and change port
  • Protect su by limiting access only to droplet admin user

Requirements

  • Ansible 2.2
  • Two environment variables can be used, DO_API_KEY and DO_API_TOKEN. They both refer to the v2 token.

Installation

Using ansible-galaxy:

$ ansible-galaxy install lafarer.do-droplets

Using requirements.yml:

- src: lafarer.do-droplets

Using git:

$ git clone https://github.com/lafarer/ansible-role-do-droplets.git lafarer.do-droplets

Role Variables

---
# The public SSH keys you want to add to your account.
# do_keys:
#   - name: mykey                             # The name of a SSH key
#     pub_key_file: "~/.ssh/id_rsa.pub"       # The public SSH key file
do_keys: []

# Droplets to be created
# do_droplets:
#   backups_enabled:    no                    # Boolean, enables backups for your droplet.
#   image_id:           ubuntu-16-04-x64      # This is the slug of the image you would like the droplet created with.
#   name:               mydroplet             # The name of the droplet. Must be unique.
#   port:               22                    # SSH port
#   private_networking: no                    # Boolean, add an additional, private network interface to droplet for inter-droplet communication.
#   region_id:          fra1                  # This is the slug of the region you would like your server to be created in.
#   size_id:            512mb                 # This is the slug of the size you would like the droplet created with.
#   ssh_key_name:       mykey                 # SSH key name (defined in do_keys)
#   user:               lookup('env', 'USER') # Admin user to create
#   virtio:             yes                   # Boolean, turn on virtio driver in droplet for improved network and storage I/O.
#   wait:               yes                   # Wait for the droplet to be in state 'running' before returning.
#   wait_timeout:       600                   # How long before wait gives up, in seconds.
#
do_droplets: []

# Inventory file to update
do_inventory_file:

Dependencies

Example Playbook

Create your own Playbook

- name: Provision DigitalOcean droplets
  hosts: localhost
  gather_facts: no
  vars:
    do_keys:
      - name: [email protected]
        pub_key_file: "~/.ssh/id_rsa.pub"
    do_droplets:
      - name: example.com
        port: 4222
        user: admin
        ssh_key_name: [email protected]
    do_inventory_file: ~/.ansible/hosts

  roles:
    - lafarer.do-droplets

License

MIT

ansible-role-do-droplets's People

Contributors

jonnyparris avatar lafarer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.