# PDC servers (both frontend and backend)

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

- name: dole out the generic configuration
  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"

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

  roles:
  - base
  - rkhunter
  - nagios_client
  - zabbix/zabbix_agent
  - collectd/base
  - hosts
  - ipa/client
  - role: openvpn/client
    when: env != "staging" and datacenter == 'iad2'
  - sudo

  tasks:
  - 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:
  - mod_wsgi
  - role: fedmsg/base
  # Set up for fedora-messaging
  - role: rabbit/user
    username: "pdc{{ env_suffix }}"
    sent_topics: ^org\.fedoraproject\.{{ env_short }}\.(pdc|logger)\..*
    when: inventory_hostname.startswith(('pdc-web01','pdc-web01.stg'))
  - pdc/frontend
