Skip to content

Instantly share code, notes, and snippets.

@sgargan
sgargan / all
Created April 9, 2014 15:49
Ansible extra vars 1.5.4 issue
cluster_name: dev
@sgargan
sgargan / all
Created May 30, 2014 11:06
Ansible extra vars resolution issue
cluster_name: dev
@sgargan
sgargan / all
Last active August 29, 2015 14:14
template resolution with includes issue
cluster_name: dev
another: foo
testing: {}
@sgargan
sgargan / remove_keys.yml
Created February 13, 2015 15:40
Removing unknown keys from authorized keys with Ansible
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: add a couple of keys to an authorized_keys file
authorized_key: path='./keys' user=sgargan key="{{ lookup('file', './ansible.pub') }}"
- authorized_key: path='./keys' user=sgargan key="{{ lookup('file', './sgargan.pub') }}"
class Task:
def __init__(self, task):
self.results = {}
def add_result(self, host, result):
self.results[host] = result
print "task (%s), results(%s) count(%s)" % (id(self), id(self.results), len(self.results))
class CallbackModule(object):
class Tasky:
def __init__(self, task):
self.results = {}
def add_result(self, host, result):
self.results[host] = result
print "task (%s), results(%s) count(%s)" % (id(self), id(self.results), len(self.results))
class CallbackModule(object):
@sgargan
sgargan / gist:a8e7ae463bace6130dc5
Last active August 29, 2015 14:17
Sandbox inventory
sandbox1 ansible_ssh_host=11.22.33.44 ansible_ssh_user=ubuntu ansible_ssh_private_key_file=~/.ssh/oste.pem
[sandbox]
sandbox1
@sgargan
sgargan / gist:860b14e92c7459ed6bc9
Created April 3, 2015 13:17
Multiline task line in file
- name: change cgi path
lineinfile:
dest: /usr/local/nagios/share/config.inc.php
line: "$cfg['cgi_base_url']='/cgi-bin';"
regexp: (cgi_base_url)
@sgargan
sgargan / database.yml
Created April 8, 2015 12:01
Create postgres db with user
- name: create the hdpoker database
action:
module: postgresql_db
db: '{{postgres_name}}'
login_host: '{{ postgres_host }}'
login_user: '{{postgres_admin_username}}'
login_password: '{{postgres_admin_password}}'
encoding: 'UTF-8'
state: '{{item}}'
@sgargan
sgargan / gist:ab237071111aaecabc38
Created April 17, 2015 18:50
config_balancer.yml
- debug: msg='adding {{instance_id}} to {{ balancer_name}}'
- local_action:
module: ec2_elb
ec2_elbs: "{{ balancer_name }}"
aws_access_key: '{{ ec2_access_key }}'
aws_secret_key: '{{ ec2_secret_key }}'
state: '{{state}}'
region: '{{ region }}'
instance_id: "{{ instance_id }}"
wait: no