Skip to content

Instantly share code, notes, and snippets.

View jimi-c's full-sized avatar

James Cammarata jimi-c

View GitHub Profile
def check_systemd(name):
# verify service is managed by systemd
systemd_enabled = 'false'
f = open('/proc/1/cmdline', 'r')
for line in f:
if 'systemd' in line:
return True
return False
diff --git a/cloud/docker/docker.py b/cloud/docker/docker.py
index ba0828d..1417da0 100644
--- a/cloud/docker/docker.py
+++ b/cloud/docker/docker.py
@@ -781,7 +781,7 @@ class DockerManager(object):
return containers
- def restart_named_container(self, existing_container):
+ def should_restart_named_container(self, existing_container):
# ansible-playbook -vv samples/test_blocks_of_blocks.yml
Using /etc/ansible/ansible.cfg as config file
1 plays in samples/test_blocks_of_blocks.yml
PLAY ***************************************************************************
TASK [debug msg=are we there yet?] *********************************************
ok: [localhost] => {
"changed": false,
"msg": "are we there yet?"
import cStringIO
import multiprocessing
import os
import pickle
import struct
import sys
import zlib
class MyProcess(multiprocessing.Process):
def __init__(self, s):
- hosts: localhost
gather_facts: no
tasks:
- command:
_raw_params: echo "hello world"
@jimi-c
jimi-c / gist:5188949
Created March 18, 2013 17:16
Quick (untested) patch to remote.py in cobbler to prevent a failed power system call from stopping execution on other systems
diff --git a/cobbler/remote.py b/cobbler/remote.py
index 181b5c6..8ef45b7 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -255,8 +255,11 @@ class CobblerXMLRPCInterface:
def background_power_system(self, options, token):
def runner(self):
for x in self.options.get("systems",[]):
- object_id = self.remote.get_system_handle(x,token)
- self.remote.power_system(object_id,self.options.get("power",""),token,logger=self.logger)
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index 716ac59..15ac998 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -361,8 +361,16 @@ class PlayBook(object):
# add facts to the global setup cache
for host, result in contacted.iteritems():
- facts = result.get('ansible_facts', {})
- self.SETUP_CACHE[host].update(facts)
class SSHConnection(...)
""" initiates an ssh connection """
...
class Connection(SSHConnection):
def __init__(self, runner, host, port, user, password, private_key_file, *args, **kwargs):
super(Connection,self).__init__(
runner=runner,
host=host,
diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py
index 934e5d6..03216fe 100644
--- a/lib/ansible/playbook/play.py
+++ b/lib/ansible/playbook/play.py
@@ -177,10 +177,10 @@ class Play(object):
del dep_vars['role']
self._build_role_dependencies([dep], dep_stack, passed_vars=dep_vars, level=level+1)
dep_stack.append([dep,dep_path,dep_vars])
- # only add the current role when we're at the top level,
- # otherwise we'll end up in a recursive loop
diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py
index cca8acb..a1c621e 100644
--- a/lib/ansible/playbook/play.py
+++ b/lib/ansible/playbook/play.py
@@ -169,6 +169,10 @@ class Play(object):
vars_data = utils.parse_yaml_from_file(vars)
if vars_data:
role_vars = utils.combine_vars(vars_data, role_vars)
+ defaults = self._resolve_main(utils.path_dwim(self.basedir, os.path.join(role_path, 'defaults')))
+ defs_data = {}