Skip to content

Instantly share code, notes, and snippets.

View jctanner's full-sized avatar

James Tanner jctanner

View GitHub Profile
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index 779f300..8728965 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -601,6 +601,7 @@ class PlayBook(object):
play_hosts.append(all_hosts.pop())
serialized_batch.append(play_hosts)
+ task_errors = False
for on_hosts in serialized_batch:
diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py
index 1c0a017..876f206 100644
--- a/lib/ansible/runner/connection_plugins/ssh.py
+++ b/lib/ansible/runner/connection_plugins/ssh.py
@@ -138,7 +138,7 @@ class Connection(object):
os.write(self.wfd, "%s\n" % self.password)
os.close(self.wfd)
- def _communicate(self, p, stdin, indata):
+ def _communicate(self, p, stdin, indata, su=False, sudoable=False, prompt=None):
@jctanner
jctanner / gather.py
Created April 7, 2014 15:29
Ansible Install Troubleshooting
#!/usr/bin/env python
import sys
import os
import hashlib
import ansible
from ansible import utils
sitedirs = []
#!/usr/bin/env python
import xmlrpclib, httplib, sys
from operator import itemgetter
SATELLITE_URL = "http://xmlrpc.rhn.redhat.com/rpc/api"
SATELLITE_LOGIN = "RHN_USERNAME"
SATELLITE_PASSWORD = "RHN_PASSWORD"
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
#!/bin/bash
# A hackaround for test-module and pdb and ansible 2.x
#
# Usage:
# test-module-v2 -m <modulepath> -a @<argsfile>
#
# Notes:
# * space delimited args are not functional, use an args file with @ instead
# * pdb can be used in module code with this script
@jctanner
jctanner / modules_changelog.py
Created April 20, 2016 22:13
Ansible CHANGELOG and new module comparatorator
#!/usr/bin/env python
##########################################################################################
# A script to validate all new modules in the devel branch are in the CHANGELOG.md
##########################################################################################
#
# EXAMPLE ...
# [jtanner@ansidev scratch]$ ./modules_changelog.py ~/workspace/github/ansible/ansible
# MODULE (azure_deployment) IS NOT IN THE 2.1 CHANGELOG!!!
[jtanner@ansidev AP-15655]$ cat checkpython.py
#!/usr/bin/env python
import sys
print(sys.path)
import ansible
print ansible.__file__
[jtanner@ansidev AP-15655]$ ansible localhost -c local -m shell -a "./checkpython.py"
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 7ae2cb9..312712f 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -1975,6 +1975,16 @@ class AnsibleModule(object):
old_env_vals['PATH'] = os.environ['PATH']
os.environ['PATH'] = "%s:%s" % (path_prefix, os.environ['PATH'])
+ # Clean out python paths set by ziploader
+ if 'PYTHONPATH' in os.environ:
/usr/bin/rsync --delay-updates -F --compress --archive --rsh 'ssh -i /home/mradmin/.ssh/id_rsa.bak -S none -o StrictHostKeyChecking=no' --out-format='<<CHANGED>>%i %n%L' \"/tmp/foo\" \"HOST2:/tmp/foo_
$ git diff
diff --git a/utilities/logic/async_wrapper.py b/utilities/logic/async_wrapper.py
index 34ddaf1..9caf422 100644
--- a/utilities/logic/async_wrapper.py
+++ b/utilities/logic/async_wrapper.py
@@ -200,6 +200,7 @@ if __name__ == '__main__':
except SystemExit:
# On python2.4, SystemExit is a subclass of Exception.
# This block makes python2.4 behave the same as python2.5+
+ raise