# create a new virthost server system
# NOTE: should be used with --limit most of the time
# NOTE: most of these vars_path come from group_vars/backup_server or from hostvars

- name: make virthost server system
  hosts: virthost:bvirthost:buildvmhost:virthost-comm03.qa.fedoraproject.org:virthost-comm04.qa.fedoraproject.org:ibiblio01.fedoraproject.org:ibiblio04.fedoraproject.org:ibiblio03.fedoraproject.org:serverbeach07.fedoraproject.org:coloamer01.fedoraproject.org:osuosl03.fedoraproject.org:host1plus01.fedoraproject.org:dedicatedsolutions01.fedoraproject.org:tummy01.fedoraproject.org:osuosl01.fedoraproject.org:virthost-comm02.qa.fedoraproject.org:serverbeach06.fedoraproject.org:serverbeach08.fedoraproject.org:virthost-s390.qa.fedoraproject.org:osuosl02.fedoraproject.org:serverbeach10.fedoraproject.org:serverbeach09.fedoraproject.org:ibiblio05.fedoraproject.org:virthost19.phx2.fedoraproject.org:virthost20.phx2.fedoraproject.org:virthost21.phx2.fedoraproject.org:virthost22.phx2.fedoraproject.org
  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
  - { role: denyhosts, when: ansible_distribution_major_version|int != 7 }
  - nagios_client
  - hosts
  - fas_client
  - collectd/base
  - { role: iscsi_client, when: datacenter == "phx2" }
  - sudo
  - { role: openvpn/client, when: datacenter != "phx2" }

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

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