Skip to content

Instantly share code, notes, and snippets.

@stevepereira
stevepereira / pre-commit
Created March 25, 2014 17:29
Ansible vault pre-commit
#!/bin/sh
#
# Pre-commit hook that verifies if all files containing 'vault' in the name
# are encrypted.
# If not, commit will fail with an error message
#
# File should be .git/hooks/pre-commit and executable
FILES_PATTERN='.*vault.*\.yml$'
REQUIRED='ANSIBLE_VAULT'
@stevepereira
stevepereira / gist:9466606
Created March 10, 2014 15:00
Redis install via rpm - you can pull the version out as a variable if it's stated in the role yaml
cache = Chef::Config[:file_cache_path]
rpm = redis-2.8.7-1.el6.remi.x86_64.rpm
remote_file "#{cache}/#{rpm}" do
source "http://rpms.famillecollet.com/enterprise/6/remi/x86_64/#{rpm}"
end
rname = File.basename("#{rpm}", '.*')
if `rpm -qa | grep #{rname}`.empty?
{
"variables":{
"home": "{{env `HOME`}}",
"iso": "{{ user `home` }}/Downloads/CentOS-6.3-x86_64-bin-DVD1.iso"
}
...
---
# file ruby.yml
- hosts: all
gather_facts: false
sudo: true
vars:
# Where to install rbenv
- rbenv_root: /usr/local/rbenv
# The version of Ruby to install
server {
listen 8443 default ssl;
server_name www.yourdomain.com;
ssl on;
ssl_certificate /etc/nginx/conf.d/cert.pem;
ssl_certificate_key /etc/nginx/conf.d/cert.key;
client_max_body_size 50M;
error_log /var/log/nginx/elasticsearch-errors.log;
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
doctor
tap homebrew/dupes
tap homebrew/binary
tap phinze/homebrew-cask
tap caskroom/versions
tap homebrew/games
update
$ grep 'node\[:network\]\[:interfaces\].' \#chef.log
10:15 < mkent_> node[:network][:interfaces][:eth1][:addresses]
22:24 <+Damm> msf, just pulling in the node[:network][:interfaces] attributes
20:44 < randybias> node[:network][:interfaces][:eth0][:addresses]
09:13 < sinBot> so fujin if I wanted to use that in an erb template, it'd be <%= @node[:network][:interfaces]["en1"]["addresses"].select{address}.flatten.to_str %> ?
12:27 < cwj> if i have an ipv4 ip address set on eth0, will it always be in @node[:network][:interfaces][:eth0][1] ?
02:19 < pluesch0r> however, i don't seem to be able to access @node[:network][:interfaces]... from inside the attributes file.
19:52 <@jtimberman> or node[:network][:interfaces][:eth0][:addresses][0]
20:09 < seryl> well, it's searchable. I'm trying the @node[:network][:interfaces][:eth0][:addresses][0] route, but getting blanks right now, playing around with it in chef solo
20:29 < kallistec> pp node[:network][:interfaces].current_attribute
@stevepereira
stevepereira / gist:6939555
Created October 11, 2013 18:20
Redis config, she no work.
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
daemon
#debug
#quiet
user haproxy
group haproxy
stats socket /var/run/haproxy.sock