Code Monkey home page Code Monkey logo

ansible-initial-server-setup's Introduction

Ansible Playbook for Initial Server Setup with Ubuntu 14.04

An Ansible playbook which runs a series of configuration steps to increase the security and usability of a new Ubuntu 14.04 server, in order to provide a solid foundation for subsequent actions.

It borrows heavily from the work of: Bryan Kennedy, Ryan Eschinger, Ashley Rich, and Digital Ocean

It will perform the following:

  • Create a new "super user" with root privileges and public key authentication
  • Implement several SSH hardening techniques
  • Configure a basic firewall
  • Configure the timezone and enable time synchronization
  • Modify the hostname and hosts file
  • Enable unattended upgrades
  • Install Fail2Ban

Optional extras:

  • Install New Relic Server monitoring
  • Install customised shell with Zsh and oh-my-zsh

Requirements

  • Ansible installed locally on your machine
  • Root SSH access to a new Ubuntu 14.04 VPS

Configuration

Clone the repo

$ git clone https://github.com/lukeharvey/ansible-initial-server-setup.git

Modify the variables in vars/main.yml according to your needs:

user: the username for your new "super user"

password: a hashed sudo password

public_key: the local path to your public SSH key

fqdn: your chosen FQDN

hostname: your chosen hostname

timezone: the most appropriate timezone for your server

ssh_port: your chosen SSH port

enable_newrelic: change to no to disable installation of New Relic Server monitor, which requires a New Relic license key

newrelic_license_key: your New Relic license key

enable_custom_shell: change to no to disable installation of customised shell with Zsh and oh-my-zsh

Testing

A Vagrantfile is provided which allows the playbook to be tested locally.

You will need Vagrant and Virtualbox installed, and you should uncomment the following lines in ansible.cfg to makes things work nicely.

# private_key_file = ~/.vagrant.d/insecure_private_key
# host_key_checking = False

Then run $ vagrant up to generate your virtual machine.

And then run the playbook:

$ ansible-playbook test_server_setup.yml

Production

Add your server's IP address to the hosts file

[production]
# e.g 192.168.1.1
# or host.example.com

Then run the playbook:

$ ansible-playbook initial_server_setup.yml --ask-pass

ansible-initial-server-setup's People

Contributors

lukeharvey avatar

Watchers

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