diff options
author | Michael Scherer <misc@zarb.org> | 2014-12-12 11:54:55 +0100 |
---|---|---|
committer | Michael Scherer <misc@zarb.org> | 2014-12-12 11:54:55 +0100 |
commit | e7fc28f43ff210574682445ba62239f840888b76 (patch) | |
tree | 84fb0e4b4de28fbb2b8f428c58cf8aed2e0e2822 | |
parent | dd06fb0a56feba126cce5ef75e84e23eb72fe7aa (diff) |
Add the local deploy role
-rw-r--r-- | roles/local_deploy/files/ansible_run.sh | 2 | ||||
-rw-r--r-- | roles/local_deploy/files/post-receive.private.sh | 2 | ||||
-rw-r--r-- | roles/local_deploy/files/post-receive.public.sh | 4 | ||||
-rw-r--r-- | roles/local_deploy/tasks/main.yml | 22 |
4 files changed, 30 insertions, 0 deletions
diff --git a/roles/local_deploy/files/ansible_run.sh b/roles/local_deploy/files/ansible_run.sh new file mode 100644 index 0000000..868ff02 --- /dev/null +++ b/roles/local_deploy/files/ansible_run.sh @@ -0,0 +1,2 @@ +#!/bin/sh +ansible-playbook -i '127.0.0.1,' -c local playbooks/deploy.yml diff --git a/roles/local_deploy/files/post-receive.private.sh b/roles/local_deploy/files/post-receive.private.sh new file mode 100644 index 0000000..e6d6abb --- /dev/null +++ b/roles/local_deploy/files/post-receive.private.sh @@ -0,0 +1,2 @@ +#!/bin/sh +GIT_WORK_TREE=/etc/ansible/ git checkout -q -f diff --git a/roles/local_deploy/files/post-receive.public.sh b/roles/local_deploy/files/post-receive.public.sh new file mode 100644 index 0000000..ce4da28 --- /dev/null +++ b/roles/local_deploy/files/post-receive.public.sh @@ -0,0 +1,4 @@ +#!/bin/sh +GIT_WORK_TREE=/etc/ansible/ git checkout -q -f +# run ansible +/usr/local/bin/ansible_run.sh diff --git a/roles/local_deploy/tasks/main.yml b/roles/local_deploy/tasks/main.yml new file mode 100644 index 0000000..b6f466e --- /dev/null +++ b/roles/local_deploy/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- yum: name={{ item }} state=installed + with_items: + - ansible + - git + +- shell: creates=/srv/git_repos/{{ item }}/config chdir=/srv/git_repos/{{ item }} git init --bare -q --shared=group + with_items: + - public + - private + +- copy: dest=/srv/git_repos/{{ item }}/hooks/post-receive src=post-receive.{{ item }}.sh mode=0755 + with_items: + - public + - private + + +- copy: src={{ item }} dest=/usr/local/bin/{{ item }} mode=0755 + with_items: + - ansible_run.sh + +- cron: name="ansible run" job="/usr/local/bin/ansible_run.sh" minute=*/30 |