Only performs post-processing actions on the first server of the 5 intended to be in the group. I suspect there is something wrong with the way I am adding to the group "slaves".
---
- 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
files:
/root/.ssh/authorized_keys: /home/tofarley/.ssh/id_rsa.pub
wait: yes
register: rax
# ISSUE: This part is not working. It only adds the first
# server created to the group.
# 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' \;