Base Ansible Role
This is a basic Ansible role that installs some common development tools and system configurations for doing full stack web development. It installs or sets up:
- Some common BASH profile tweaks
- Ruby
- Node.js
- Yarn
- Git
- Vim
- SASS
- Bower
- Grunt
- Gulp
- A swap file
- Sysctl settings
- The default timezone
- APT unattended upgrades
Role Variables
The role is designed to create a basic development environment out of the box, however there are some additional variables that can be set as required:
env_name
— Whether the server is going to be used for "development" or "production" or other. Default is "dev".timezone
— What timezone the server is in. Default is "Etc/UTC".console_user
— If you are setting up a new user for your server, you can use this value to install the BASH profile for that user. Default isansible_user
swap_mb
— Size of swap file to create. Default is 0 (ie, no swap).swap_path
— Location to store the swap file. Default is "/swap".shmmax_percent
— Percentage of available memory to use forkernel.shmmax
. Default is "50".shmall_percent
— Percentage of available memory to use forkernel.shmall
. Default is "50".default_groups
— Groups to add the Ansible user orconsole_user
to. Values are "web-admin" and "www-data".
Example Playbook
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: bbatsche.Base }
License
MIT
Testing
Included with this role is a set of specs for testing each task individually or as a whole. To run these tests you will first need to have Vagrant and VirtualBox installed. The spec files are written using Serverspec so you will need Ruby and Bundler.
To run the full suite of specs:
$ gem install bundler
$ bundle install
$ rake
The spec suite will target both Ubuntu Trusty Tahr (14.04) and Xenial Xerus (16.04).
To see the available rake tasks (and specs):
$ rake -T
These specs are not meant to test for idempotence. They are meant to check that the specified tasks perform their expected steps. Idempotency is tested independently via integration testing.