Skip to content

Instantly share code, notes, and snippets.

View jctanner's full-sized avatar

James Tanner jctanner

View GitHub Profile
@jctanner
jctanner / ansible_5146
Created January 3, 2014 14:32 — forked from rajasaur/ansible_5146
CELERY + RABBITMQ EXAMPLE
#!/usr/bin/env python
#################################
# test.py (Playbook Execute Task)
#################################
from celery import Celery
from ansible.playbook import PlayBook
from ansible.runner import Runner
  • hosts: servers roles:

    • { role: username.rolename, x: 42 }
@jctanner
jctanner / gist:8409824
Created January 13, 2014 23:03
sysctl rewrite
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, David "DaviXX" CHANIAL <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
diff --git a/library/system/authorized_key b/library/system/authorized_key
index 7626a9a..5cae4a1 100644
--- a/library/system/authorized_key
+++ b/library/system/authorized_key
@@ -114,6 +114,27 @@ import tempfile
import re
import shlex
+class keydict(dict):
+
#!/bin/bash
OLDRELEASE="1.4.3"
NEWRELEASE="1.4.4"
NEWRELEASENAME="Could This Be Magic"
cd ~
rm -rf ansible
agc
def _set_none_to_blank(dictionary):
result = dictionary
for k in result.iterkeys():
if type(result[k]) == dict:
result[k] = _set_non_to_blank(result[k])
elif not result[k]:
result[k] = ""
return result
#!/usr/bin/env python
from ansible.runner.action_plugins.synchronize import ActionModule as Synchronize
class FakeRunner(object):
def __init__(self):
self.connection = None
self.transport = None
self.basedir = None
self.sudo = None
#!/bin/bash
OLDRELEASE="1.4.3"
NEWRELEASE="1.4.4"
NEWRELEASENAME="Could This Be Magic"
cd ~
rm -rf ansible
agc
def test_get_diff(self):
standard = dict(
before_header='foo',
after_header='bar',
before='fooo',
after='foo'
)
standard_expected_py27 = """--- before: foo
+++ after: bar
@@ -1 +1 @@
DEVEL
jtanner@u1204:~/issues/jlaska-awx-install-fail$ ansible -i inventory localhost -m file -a "path=/tmp/newfoo state=file"
localhost | FAILED >> {
"failed": true,
"msg": "file (/tmp/newfoo) is absent, cannot continue",
"path": "/tmp/newfoo",
"state": "absent"
}
1.4.5