- name: check/create instance
  hosts: koschei.cloud.fedoraproject.org
  user: root
  gather_facts: False

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

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

- name: provision instance
  hosts: koschei.cloud.fedoraproject.org
  gather_facts: True
  user: fedora
  sudo: yes

  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"
  - include: "{{ tasks }}/postfix_basic.yml"

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

- name: setup fedmsg
  hosts: koschei.cloud.fedoraproject.org
  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

  roles:
  - nagios_client
  - role: fedmsg/base
    fedmsg_fqdn: koschei.cloud.fedoraproject.org

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