Skip to content

Instantly share code, notes, and snippets.

---
- hosts: all
sudo: yes
roles:
- role: postgresql
tags: postgresql
@mpolden
mpolden / gist:8559017
Created January 22, 2014 13:49
Example for Ansible git-module and ssh agent forwarding
# files/env:
Defaults env_keep += "SSH_AUTH_SOCK"
# tasks/main.yml
- name: ensure sudo keeps SSH_AUTH_SOCK in environment
copy: src=env
dest=/etc/sudoers.d/env
mode=0440
owner=root
group=root
@mpolden
mpolden / gist:8418716
Last active January 3, 2016 05:49
Reproducible development environments using Vagrant

Reproducible development environments using Vagrant

Meta: Originally published by me on the internal Statoil developer blog. (2013-11-12)

The complexity of any given development environment often grows at the same rate as the project itself.

A large project can have countless dependencies such as a web server, a database, a caching system, a queue and more. This amounts to a lot of configuration and administration overhead. Suddenly, adding a new developer to the project means spending days just installing build tools, services, libraries and other dependencies before he/she can write any code.

Each developer might also be running different operating systems and using different tools, some might run Windows, others Linux or OS X. This adds to the complexity as some dependencies might have subtle platform-specific differences and/or bugs. Developing on an OS that differs from the production OS can also lead to subtle bugs when the application is deploye

@mpolden
mpolden / gist:8300436
Created January 7, 2014 14:54
Ansible role-specific vars_prompt
- hosts: production
sudo: yes
roles:
- ntp
- postgresql
- nginx
- role: deploy
tags: deploy
vars_prompt:
- name: "version"
final Collection<Integer> ids =
Collections2.filter(Lists.transform(Arrays.asList(
input.split(",")),
new Function<String, Integer>() {
@Override
public Integer apply(@Nullable final String s) {
return s != null ? Ints.tryParse(s) : null;
}
}), new Predicate<Integer>() {
@Override