- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml"
  vars:
    myhosts: "busgateway:busgateway_stg"

- name: dole out the generic configuration
  hosts: busgateway:busgateway_stg
  user: root
  gather_facts: True

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

  roles:
  - base
  - rkhunter
  - nagios_client
  - zabbix/zabbix_agent
  - hosts
  - {role: openvpn/client, when: env != "staging"}
  - ipa/client
  - collectd/base
  - fedmsg/base
  - sudo

  pre_tasks:
  - import_tasks: "{{ tasks_path }}/yumrepos.yml"

  tasks:
  - import_tasks: "{{ tasks_path }}/motd.yml"

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

- name: dole out the service-specific config
  hosts: busgateway:busgateway_stg
  user: root
  gather_facts: True

  roles:
  - role: fedmsg/hub
    enable_websocket_server: True
  - role: fedmsg/relay
  - role: fedmsg/gateway
  - role: collectd/fedmsg-service
    process: fedmsg-hub
  - role: collectd/fedmsg-service
    process: fedmsg-relay
  - role: collectd/fedmsg-service
    process: fedmsg-gateway
  - role: collectd/fedmsg-activation

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

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"
