add clone murder-repos role

This commit is contained in:
YAMASAKI Masahide 2013-10-11 23:57:05 +09:00
parent ba90497f07
commit 1980cf4bce
6 changed files with 23 additions and 8 deletions

1
.gitignore vendored
View File

@ -38,5 +38,6 @@ nosetests.xml
ansible.cfg
*.pem
*.torrent
murder_dist.tar.gz
stage
murder/

View File

@ -1,7 +1,9 @@
- name: Deploy
hosts: peer
hosts:
- seeder
- peer
sudo: yes
roles:
- murder/peer

View File

@ -1,3 +1,7 @@
- name: get distribute_files
hosts: ansible_host
roles:
- admin/clone_murder_files
- name: Upload the support files
hosts:

View File

@ -27,4 +27,4 @@ torrent_path: .
remote_murder_path: /usr/local/murder
ansible_cache_path: /var/cache/ansible
default_temp_path: /tmp
murder_dist_tgz_file: /tmp/murder_dist_upload.tar.gz
murder_dist_tgz_file: ./murder_dist.tar.gz

View File

@ -4,8 +4,11 @@
register: clone_status
tags: clone_murder_files
- name: tar -czf
shell: tar -czf ./murder_dist.tar.gz -C ./murder/dist/
- name: rm old tgz
shell: rm -f {{ murder_dist_tgz_file }}
when: clone_status.changed
- name: tar -czf
shell: tar -czf {{ murder_dist_tgz_file }} -C ./murder/dist/ . creates={{ murder_dist_tgz_file }}
tags: clone_murder_files

View File

@ -16,14 +16,19 @@
- name: clean up remote_murder_path
shell: |
[ $(find {{ remote_murder_path }}/* | wc -l ) -lt 1000 ] &&
rm -rf {{ remote_murder_path }}/* ||
rm -rf {{ remote_murder_path }} ||
( echo 'Cowardly refusing to remove files! Check the remote_murder_path.' ; exit 1 )
when: copy_status.changed
register: rm_status
tags: distribute_files
- name: tar xzf
shell: tar xzf {{ ansible_cache_path }}/murder_dist.tar.gz -C "{{ remote_murder_path }}"
when: copy_status.changed
- name: dir stat
stat: path={{ remote_murder_path }}/BitTornado
register: st
- name: tar -xzf
shell: mkdir -p {{ remote_murder_path }} && tar -xzf {{ ansible_cache_path }}/murder_dist.tar.gz -C {{ remote_murder_path }}
when: st.stat.isdir is undefined
tags: distribute_files