# setup a transient el6 instance
# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'"
#
# You might need to run it with `-c paramiko` for it to finish cleanly

- name: check/create instance
  hosts: lockbox01.phx2.fedoraproject.org
  user: root
  gather_facts: False

  vars_files: 
   - /srv/web/infra/ansible/vars/global.yml
   - "{{ private }}/vars.yml"

  vars:
  - keypair: fedora-admin-20130801
  - image: "{{ el6_qcow_id }}"
  - instance_type: m1.small
  - security_group: default

  tasks:
  - include: "{{ tasks }}/transient_cloud.yml"

- name: provision instance
  hosts: tmp_just_created
  user: root
  gather_facts: True

  vars_files: 
   - /srv/web/infra/ansible/vars/global.yml
   - "{{ private }}/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  tasks:
  - include: "{{ tasks }}/growroot_cloud.yml"
  - include: "{{ tasks }}/cloud_setup_basic.yml"


  handlers:
  - include: "{{ handlers }}/restart_services.yml"
