Skip to content

Instantly share code, notes, and snippets.

@jctanner
Created December 5, 2013 22:59
Show Gist options
  • Save jctanner/7815571 to your computer and use it in GitHub Desktop.
Save jctanner/7815571 to your computer and use it in GitHub Desktop.
random facts
````
diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py
index 68c6f17..8f5c468 100644
--- a/lib/ansible/runner/connection_plugins/ssh.py
+++ b/lib/ansible/runner/connection_plugins/ssh.py
@@ -251,6 +251,14 @@ class Connection(object):
if p.returncode != 0 and controlpersisterror:
raise errors.AnsibleError('using -c ssh on certain older ssh versions may not support ControlPersist, s
+
+ #if stderr is not None and stderr is not "":
+ if len(stderr) > 0:
+ open("/tmp/awx-error.log", "a").write("stdout=%s stderr=%s\n" % (len(stdout), stderr))
+ else:
+ open("/tmp/awx-error.log", "a").write("stdout=%s\n" % len(stdout))
+
+
return (p.returncode, '', stdout, stderr)
def put_file(self, in_path, out_path):
diff --git a/library/system/setup b/library/system/setup
index 7d69d22..454258a 100755
--- a/library/system/setup
+++ b/library/system/setup
@@ -149,6 +149,29 @@ class Facts(object):
self.get_user_facts()
self.get_local_facts()
self.get_env_facts()
+ self.get_random_facts()
+
+ def get_random_facts(self):
+
+ """
+ ascii_letters
+ ascii_uppercase
+ ascii_lowercase
+ whitespace
+ punctuation
+ octdigits
+ letters
+ digits
+ """
+
+ import string
+ import random
+ for x in range(0, 1000):
+ thisname = "random_"
+ thisname += ''.join(random.choice(string.ascii_lowercase) for x in range(10))
+ thisval = ''.join(random.choice(string.ascii_lowercase) for x in range(100))
+ self.facts[thisname] = thisval + string.whitespace
+
def populate(self):
return self.facts
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment