summaryrefslogtreecommitdiffstats
path: root/scripts/ansible-playbook-check-diff
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2014-01-24 16:59:46 +0000
committerKevin Fenzi <kevin@scrye.com>2014-01-24 16:59:46 +0000
commit0494a018a691d6966ca83b70075433299b6062b8 (patch)
treea99f6f8465d5cf3b9f3dd6854f1182da56839b9b /scripts/ansible-playbook-check-diff
parent083b631c29186b3dd1cab45c97f33b0fad84a51a (diff)
downloadansible-0494a018a691d6966ca83b70075433299b6062b8.tar.gz
ansible-0494a018a691d6966ca83b70075433299b6062b8.tar.xz
ansible-0494a018a691d6966ca83b70075433299b6062b8.zip
Add simple script that runs --check --diff playbook runs on all hosts/groups.
Diffstat (limited to 'scripts/ansible-playbook-check-diff')
-rwxr-xr-xscripts/ansible-playbook-check-diff25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/ansible-playbook-check-diff b/scripts/ansible-playbook-check-diff
new file mode 100755
index 000000000..72c0d78b1
--- /dev/null
+++ b/scripts/ansible-playbook-check-diff
@@ -0,0 +1,25 @@
+#!/usr/bin/python -tt
+import os
+import os.path
+import subprocess
+
+rootpath = "/srv/web/infra/ansible/playbooks"
+
+#
+# Find all the .yml files under playbooks/groups and hosts and run ansible-playbook on them
+# With --check and --diff for now. We don't run the 'manual' subdir ones.
+
+for dir in ("hosts", "groups"):
+ hostsplaybookspath = os.path.join(rootpath, dir)
+ for path, dirs, files in os.walk(hostsplaybookspath):
+ for file in files:
+ if not file.endswith(".yml"):
+ continue
+ playbookpath = os.path.join(path, file)
+ cmd = ("ansible-playbook", playbookpath, "--check", "--diff")
+ ansibleprocess = subprocess.Popen(cmd)
+
+#
+# Add this if you want to run them one at a time instead of all forked off in a bunch.
+# ansibleprocess.communicate()
+#