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 ansible.cfg
*.pem *.pem
*.torrent *.torrent
murder_dist.tar.gz
stage stage
murder/ murder/

View File

@ -1,7 +1,9 @@
- name: Deploy - name: Deploy
hosts: peer hosts:
- seeder
- peer
sudo: yes sudo: yes
roles: roles:
- murder/peer - 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 - name: Upload the support files
hosts: hosts:

View File

@ -27,4 +27,4 @@ torrent_path: .
remote_murder_path: /usr/local/murder remote_murder_path: /usr/local/murder
ansible_cache_path: /var/cache/ansible ansible_cache_path: /var/cache/ansible
default_temp_path: /tmp 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 register: clone_status
tags: clone_murder_files tags: clone_murder_files
- name: tar -czf - name: rm old tgz
shell: tar -czf ./murder_dist.tar.gz -C ./murder/dist/ shell: rm -f {{ murder_dist_tgz_file }}
when: clone_status.changed 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 tags: clone_murder_files

View File

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