Giter Club home page Giter Club logo

ansible-digitalocean-sample-playbook's Introduction

Sample Ansible Playbook to provision a DigitalOcean droplet

Build Status

This is a sample playbook that illustrates how to create and provision a DigitalOcean droplet with Ansible; you can spin up and provision a droplet using the command line via this playbook.

Playbook Demo Image

This playbook does the following:

  • Spins up a DigitalOcean droplet
  • Adds the droplet's IP address to the ansible inventory file
  • Setup the swap file
  • Installs and setup fail2ban
  • Setup Uncomplicated firewall
  • Setup the timezone
  • Adds a new user account with sudo access
  • Adds a public ssh key for the new user account
  • Disables password authentication to the droplet
  • Deny root login to the droplet
  • Installs the UnattendedUpgrades package for automatic security updates
  • (Optional) Installs the LEMP stack
  • (Optional) Installs Docker

Prerequisites

Ansible >= 2.4.0.0

Usage

  1. Clone this repo:
git clone https://github.com/jasonheecs/ansible-digitalocean-sample-playbooks.git
cd ansible-digitalocean-sample-playbooks
  1. Rename the group_vars/all/secret.yml.example file to group_vars/all/secret.yml and change the secret variables to your appropriate values.

  2. Modify the values in group_vars/all/main.yml with your desired values.

  3. Run the following:

ansible-galaxy install -r requirements.yml
ansible-playbook -i hosts main.yml

Testing

Testing is done via Kitchen CI and Kitchen Ansible. Testing of the droplet setup is done via Kitchen Vagrant:

gem install bundler
bundle install
bundle exec kitchen test

Testing of the LEMP stack and Docker installation / setup is done via Kitchen Docker:

gem install bundler
bundle install
KITCHEN_YAML=".kitchen.travis.yml" bundle exec kitchen test

Refer to the travis.yml file and Travis build logs for details on the test build process and expected outputs.

License

MIT

ansible-digitalocean-sample-playbook's People

Contributors

davidzisky avatar jasonheecs 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.