Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ccamacho
Forked from tofarley/gist:8285845
Created October 13, 2016 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccamacho/960c6b1d0e916dbe9641ebdf87868ead to your computer and use it in GitHub Desktop.
Save ccamacho/960c6b1d0e916dbe9641ebdf87868ead to your computer and use it in GitHub Desktop.
My Blender render farm ansible playbook.
---
- name: Create render slaves on Rackspace Cloud
hosts: renderslaves
user: root
connection: local
gather_facts: False
tasks:
- name: Provision a set of instances
local_action:
module: rax
creds_file: /home/tofarley/.pyrax
region: DFW
networks:
- public
- private
- rendernet
name: render-slave
flavor: 2
image: ubuntu-1204-lts-precise-pangolin
count: 5
exact_count: yes
group: slaves
# nova keypair-add --pub-key /home/tofarley/.ssh/id_rsa.pub render_keypair
key_name: render_keypair
wait: yes
register: rax
# Add these servers (by public IP) to a group called slaves
# so that we can ssh into them below.
- name: Add new instance to host group
local_action: add_host hostname={{item.accessIPv4}} groupname=slaves
with_items: rax.instances
- name: Install Packages
hosts: slaves
user: root
gather_facts: True
tasks:
- name: Install apt packages
action: apt state=installed pkg={{item}} update-cache=yes
with_items:
- vim
- git
- tmux
- blender
tags:
- packages
- name: Create user
hosts: slaves
user: root
gather_facts: True
vars:
# pulled from /etc/shadow
password: $somehash$
tasks:
- action: user name=tofarley password={{password}}
- name: Copy slave.blend to server
hosts: slaves
user: root
gather_facts: True
tasks:
- copy: src=/home/tofarley/slave.blend dest=/root/slave.blend owner=root group=root mode=0644
- name: Launch blender in tmux
hosts: slaves
user: root
gather_facts: True
tasks:
# You can attach to this session with 'tmux attach -t blender'
- command: tmux new-session -d -s blender 'blender -b slave.blend --addons netrender -a -noaudio -nojoystick' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment