Skip to content

Instantly share code, notes, and snippets.

View jimi-c's full-sized avatar

James Cammarata jimi-c

View GitHub Profile
@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 = {}
# roles/test1/vars/main.yml
---
test_rolevars: TEST1_ROLEVARS
# roles/test1/tasks/main.yml
---
- debug: msg="testvar = {{ test_rolevars }}"
# roles/test2/vars/main.yml
---
diff --git a/library/system/setup b/library/system/setup
index e39910f..d21bc71 100644
--- a/library/system/setup
+++ b/library/system/setup
@@ -1443,21 +1443,23 @@ class LinuxNetwork(Network):
netmask = socket.inet_ntoa(struct.pack('!L', netmask_bin))
network = socket.inet_ntoa(struct.pack('!L', address_bin & netmask_bin))
iface = words[-1]
- if iface != device:
- interfaces[iface] = {}
diff --git a/library/system/authorized_key b/library/system/authorized_key
index 54c9576..af4810d 100644
--- a/library/system/authorized_key
+++ b/library/system/authorized_key
@@ -210,29 +210,36 @@ def parsekey(raw_key):
'ssh-rsa',
]
+ options = None # connection options
+ key = None # encrypted key string
#!/usr/bin/python
"""
Cobbler external inventory script
=================================
Ansible has a feature where instead of reading from /etc/ansible/hosts
as a text file, it can query external programs to obtain the list
of hosts, groups the hosts are in, and even variables to assign to each host.
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