Skip to content
Simple Ansible plays to configure a Ubuntu Server (14.04).
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Ansible Ubuntu Box

Simple Ansible plays to configure a Ubuntu Server (14.04).

I find myself having to do the same setup each time I start a new server. Simple things like adding my public key to the authorized key file and configuring UFW to allow some ports.

Here are somethings that are automated now:

  • Creates and sets up a new user (newuser.yml)

    • Creates new user
    • Configures passwordless ssh access
    • Adds user to sudoers
    • Disable root ssh access
    • Disable ssh access via passwords
  • Installs various things (main.yml)

    • Apt (tasks/apt.yml)
    • UFW (tasks/ufw.yml)
      • Reject all incoming connections by default
      • Allow all outgoing connections by default
      • Allow 22, 80, 443
    • Nodejs (tasks/nodejs.yml)
    • Docker (tasks/docker.yml)
    • Git
    • pip (Python)


  1. Add node ip to hosts file.

     echo NODE_ID > hosts
  2. Create new user on the droplet

     ansible-playbook -i hosts newuser.yml -u root
  3. Enter prompt for username and public key file.

  4. Update hosts file to reflect new user

     // hosts
     NODE_ID ansible_ssh_private_key_file=PATH_TO_PRIVATE_KEY ansible_ssh_user=USERNAME
     // Alternatively, update your ~/.ssh/config file.
  5. Run the main play.

     // Edit to exclude/include relevant tasks.
     ansible-playbook -i hosts main.yml


  • Add more tasks to install various things/dependencies


You can’t perform that action at this time.