- name: check/create instance
  hosts: grafana.cloud.fedoraproject.org
  user: fedora
  sudo: True
  gather_facts: False

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - /srv/private/ansible/vars.yml
   - /srv/web/infra/ansible/vars/fedora-cloud.yml
   - /srv/private/ansible/files/openstack/passwords.yml

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

- name: setup all the things
  hosts: grafana.cloud.fedoraproject.org
  user: fedora
  sudo: True
  gather_facts: True
  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - /srv/private/ansible/vars.yml
   - /srv/private/ansible/files/openstack/passwords.yml
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - base
  - rkhunter
  #- { role: denyhosts, when: ansible_distribution_major_version|int != 7 }
  - apache
  - graphite/graphite
  - graphite/statsd
  - graphite/fedmsg2statsd
  - graphite/grafana

  tasks:
  - include: "{{ tasks }}/yumrepos.yml"
  #- include: "{{ tasks }}/2fa_client.yml"
  - include: "{{ tasks }}/motd.yml"
  - include: "{{ tasks }}/mod_wsgi.yml"

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

  pre_tasks:
  - include: "{{ tasks }}/cloud_setup_basic.yml"
  - name: set hostname (required by some services, at least postfix need it)
    shell: "hostname {{inventory_hostname}}"
