summaryrefslogtreecommitdiff
path: root/roles/ansible-pull/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/ansible-pull/templates')
-rw-r--r--roles/ansible-pull/templates/etc_cron.d_metamorphosis.j22
-rw-r--r--roles/ansible-pull/templates/etc_logrotate.d_metamorphosis.j27
-rw-r--r--roles/ansible-pull/templates/usr_local_bin_metamorphose.j213
3 files changed, 22 insertions, 0 deletions
diff --git a/roles/ansible-pull/templates/etc_cron.d_metamorphosis.j2 b/roles/ansible-pull/templates/etc_cron.d_metamorphosis.j2
new file mode 100644
index 0000000..a4c9541
--- /dev/null
+++ b/roles/ansible-pull/templates/etc_cron.d_metamorphosis.j2
@@ -0,0 +1,2 @@
+# Cron job to git clone/pull a repo and then run locally
+*/15 * * * * root /usr/local/bin/pull >>/var/log/pull.log 2>&1 \ No newline at end of file
diff --git a/roles/ansible-pull/templates/etc_logrotate.d_metamorphosis.j2 b/roles/ansible-pull/templates/etc_logrotate.d_metamorphosis.j2
new file mode 100644
index 0000000..b81abbf
--- /dev/null
+++ b/roles/ansible-pull/templates/etc_logrotate.d_metamorphosis.j2
@@ -0,0 +1,7 @@
+/var/log/pull.log {
+ rotate 7
+ daily
+ compress
+ missingok
+ notifempty
+} \ No newline at end of file
diff --git a/roles/ansible-pull/templates/usr_local_bin_metamorphose.j2 b/roles/ansible-pull/templates/usr_local_bin_metamorphose.j2
new file mode 100644
index 0000000..d416526
--- /dev/null
+++ b/roles/ansible-pull/templates/usr_local_bin_metamorphose.j2
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Pull ansible configuration and upgrade system
+set -e
+
+workdir=/var/lib/ansible/local
+
+mkdir --parents "$workdir"
+/usr/bin/ansible-pull \
+ --verify-commit \
+ --checkout master \
+ --sleep 10 \
+ --directory "$workdir" \
+ --url "https://github.com/jodersky/metamorphic.git"