Skip to content

Instantly share code, notes, and snippets.

@canadaduane
Created July 20, 2013 23:57
Show Gist options
  • Save canadaduane/6046910 to your computer and use it in GitHub Desktop.
Save canadaduane/6046910 to your computer and use it in GitHub Desktop.
Ansible Rackspace Setup
---
- name: crunch
hosts: all
user: root
vars:
upcs_version: 436eef9e32e02dd574a1d10d277362fe32d952b0 # or 'master' for latest
hosts_size: "{{ groups['crunch'] | length }}"
archive_org_page_total: 680
archive_org_page_first: "{{ archive_org_page_total / int(hosts_size) * int(server_idx) }}"
archive_org_page_last: "{{ archive_org_page_total / int(hosts_size) * (int(server_idx)+1) }}"
# git vim gpm ctags vim-doc vim-scripts
tasks:
- name: update apt index
apt: update_cache=yes cache_valid_time=3600
- name: install gnu parallel
apt: pkg=parallel state=installed
- name: install ruby
apt: pkg=ruby1.9.3 state=installed
- name: install git
apt: pkg=git state=installed
- name: install vim
apt: name={{item}} state=installed
with_items:
- vim
- gpm
- exuberant-ctags
- vim-doc
- vim-scripts
- name: install pigz
apt: pkg=pigz state=installed
- name: install upcs
git: repo=https://github.com/chmouel/upcs.git
dest=/usr/local/share/upcs
version={{upcs_version}}
- name: link upcs binary
file: src=/usr/local/share/upcs/upcs
dest=/usr/local/bin/upcs
state=link
- name: prepare upcs config dir
file: dest=/root/.config/rackspace-cloud state=directory
- name: copy upcs config
copy: src=upcs.config dest=/root/.config/rackspace-cloud/config
owner=root group=root mode=0644
force=yes
- name: prepare download script dir
file: dest=/root/download state=directory
- name: copy download script
copy: src=download_all_books.rb dest=/root/download/download_all_books.rb
owner=root group=root mode=0644
force=yes
- name: install download script gems
gem: name=httparty version=0.8.3 state=present
- name: download
command: "ruby download_all_books.rb {{archive_org_page_first}} {{archive_org_page_last}} chdir=/root/download"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment