group_vars | ||
roles | ||
.gitignore | ||
create_torrent.yml | ||
deploy.yml | ||
LICENSE | ||
production | ||
README.md | ||
rm_tgz.yml | ||
setup.yml | ||
site.yml | ||
start_seeder.yml | ||
start_tracker.yml | ||
stop_all_peers.yml | ||
stop_seeder_and_tracker.yml |
ansible-lssd
Large scale server deploys using BitTorrent and the BitTornado library by Murder
DESCRIPTION
ansible-lssd is a method of using Bittorrent (Powered by Murder) to distribute files to a large amount of servers within a production environment.
QUICK START
For the impatient, sudo pip install ansible
and add these lines to your group_vars/all:
# install pip (Python package manager) and ansible
$ sudo easy_install pip
$ sudo pip install ansible
# deploy tag
tag: Deploy1
# path
seeder_files_path: ~/builds
destination_path: /opt/hoge
HOW IT WORKS
Same as the "HOW IT WORKS" of Murder.
CONFIGURATION AND USAGE
You define tracker
, seeder
and peer
server to inventory (./production) file.
All involved servers must have python and pizg installed and the related murder support files (BitTornado, etc.). To upload the support files to the tracker, seeder, and peers, run:
$ ansible-playbook -i prodction setup.yml
By default, these will go in /usr/local/murder
in your apps deploy directory.
Override this by setting the variable remote_murder_path
.
Before deploying, you must start the tracker:
$ ansible-playbook -i prodction start_tracker.yml
At this point you should be able to deploy normally:
$ ansible-playbook -i prodction deploy.yml
MANUAL USAGE (ansible-lssd without a deploy strategy)
Modify a ./production and ./group_vars/all, manually define servers:
# ansible host
[ansible_host]
localhost ansible_connection=local
# tracker node
[tracker]
10.0.0.1
# seeder node
[seeder]
10.0.0.1
# peer nodes
[peer]
10.1.1.1
10.1.1.2
10.1.1.3
# deploy tag
tag: Deploy1
# path
seeder_files_path: ~/builds
destination_path: /opt/hoge # or some other directory
To distribute a directory of files, first make sure that murder is set up on all hosts, then manually run the murder cap tasks:
- Start the tracker:
$ ansible-playbook -i prodction start_tracker.yml
- Create a torrent from a directory of files on the seeder, and start seeding:
$ scp -r ./builds host1:~/builds
$ ansible-playbook -i prodction create_torrent.yml
$ ansible-playbook -i prodction start_seeder.yml
- Distribute the torrent to all peers:
$ ansible-playbook -i prodction deploy.yml
- Stop the seeder and tracker:
$ ansible-playbook -i prodction stop_seeder_and_tracker.yml
When this finishes, all peers will have the files in /opt/hoge/Deploy1