Code Monkey home page Code Monkey logo

ansible-role-create-droplet's Introduction

ansible-role-create-droplet

Ansible role for creating DigitalOcean droplets, with an emphasis on sane defaults for parameters.

Overview

The motivation for this role was frustration around the fact that Ansible doesn't provide a method for declaring default variables to modules. Without default variables, every module invocation is unnecessarily verbose:

- name: create digitalocean droplet
  digital_ocean:
    command: droplet
    state: present
    name: testbox
    unique_name: true

    size_id: 512mb
    region_id: sfo1
    # Debian 8 64-bit has slug "debian-8-x64" and id "14169880"
    image_id: "14169880"
    private_networking: true

    api_token: "{{ digitalocean_api_token }}"
    ssh_key_ids: "{{ digitalocean_ssh_key_ids | join(',') }}"

The only new variable in the above block is name: testbox. All other variables should reference defaults. Using a role as a surrogate module makes referencing default variables possible.

Usage

- name: create digitalocean droplet
  hosts: localhost
  roles:
    - { role: create-droplet,
        droplet_name: testbox,
      }

Ah, that's better!

License

MIT

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.