Skip to content

chesterbr/chester-ansible-configs

Repository files navigation

chester-ansible-configs

This project contains the configuration for my personal projects (which I automated in an effort to further explore Ansible, Vagrant and related tools), and published because:

  • Ansible exemples may be useful to someone else (despite being very specific to my stuff);
  • It keeps me honest (makes me write scripts that don't suck much, forces me not to have plaintext secrets, exposes security flaws, etc.);
  • Public github is free Not really a reason anymore 🎉

Feel free to use it (I'm licensing as MIT to ensure that) and to open issues or contact me if you find something awry.

If you want to learn Ansible, I strongly recommend Jeff Geerling's Ansible for DevOps. Several tasks here were based on tasks on his book or some of his tasks in Ansble Galaxy.

(Se você lê Português, veja também o Caixa de Ferramentas DevOps do Gleicon Moraes)

What does it configure?

cruzalinhas

An app that allows quickly finding public transportation routes in São Paulo. See source code or website for details. It shares the same nginx with the Toronto Transit (below).

Toronto Transit for Pebble

Back-end for a Pebble app that finds the nearest bus/streetcar stops and shows how long it will take for the next vehicles to arrive.

miniTruco server

This is a simple Java app that listens on the 6912 port, handling communication between miniTruco clients and spawning bot players to fill incomplete tables (a miniTruco table requires 4 players).

staticman

A fork of Staticman that I use to handle comments on my blog. It's a Node.js app that listens on port 3002.

Older scripts (not on main branch anymore)

Home automation Raspberry Pi

Before switching to Home Assistant, I manually configured my RPi to add voice control to my lights and TV, among other home automation tasks. For that I had plabooks to provision it and configure the apps, so I could tinker with confidence.

Quick setup (Mac OS X)

This will get you a VM capable of running any of those services:

brew update
brew install rbenv ansible
brew cask install virtualbox vagrant
vagrant up

To install one (or more) of the services on the virtual machine, run its playbook:

ansible-playbook <playbook name>.yml -i hosts,

(alternatively you can use -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory, but it will log in with the default user for Ubuntu provisioning, not the {{ admin_user }} defined on the global vars)

Run this script to enable development sites (it redirects ports - until reboot - and add entries to /etc/hosts; run it again to revert all changes):

sudo ./config-dev-environment

Now you can open, say, http://dev.chester.me.

Passwords vault

A few tasks (including the initial run of each playbook) require you to supply your own password vault. See the sample file for details.

Production provisioning

Initial server setup is done by running provisioning.yml with the root user (-u root) against the proper host (one of its tasks is to create the proper user, then disable root and password-based logins).

Once that is done, playbooks may be ran on the proper hosts. Currently I ran all of them on the same host, but they can theoretically live in different machines.

Maintenance tasks

Those are tagged on the playbooks, please check them for such tags and add to ansible-playbook. Examples:

  • To download new data from sptrans: --tags update_sptrans_data;
  • To deploy the latest version of cruzalinhas or toronto-transit-time: --tags update_app.

About

Ansible/Vagrant/etc. configuration for my personal projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published