# PDC servers (both frontend and backend)

- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=pdc-web:pdc-web-stg:pdc-backend:pdc-backend-stg"

- name: dole out the generic configuration
  hosts: pdc-web:pdc-web-stg:pdc-backend:pdc-backend-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
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

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

  roles:
  - base
  - rkhunter
  - nagios_client
  - collectd/base
  - hosts
  - fas_client
  - sudo

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

- name: stuff for the web nodes
  hosts: pdc-web:pdc-web-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
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

  roles:
  - role: openvpn/client
    when: env != "staging"
  - mod_wsgi
  - fedmsg/base
  - pdc/frontend

- name: stuff just for the backend nodes
  hosts: pdc-backend:pdc-backend-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
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

  roles:
  - fedmsg/base
  - fedmsg/hub
  - pdc/backend
  - role: collectd/fedmsg-service
    process: fedmsg-hub
