# create a new dns server

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

- name: make the box be real
  hosts: repospanner
  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
  - hosts
  - rkhunter
  - nagios_client
  - fas_client
  - collectd/base
  - sudo
  - openvpn/client
##
## The ansible region is an attempt to share certain zones in batcave
## with pagure.
  - { role: repospanner/server,
      node: repospanner01,
      region: ansible,
      spawn_repospanner_node: true,
      rpc_port: 8442,
      http_port: 8443,
      when: inventory_hostname == 'repospanner01.phx2.fedoraproject.org'
    }
  - { role: repospanner/server,
      node: repospanner02,
      region: ansible,
      spawn_repospanner_node: false,
      join_repospanner_node: repospanner01.ansible.fedoraproject.org,
      rpc_port: 8442,
      http_port: 8443,
      when: inventory_hostname == 'repospanner-cc-rdu01.fedoraproject.org'
    }
  - { role: repospanner/server,
      node: repospanner03,
      region: ansible,
      spawn_repospanner_node: false,
      join_repospanner_node: repospanner01.ansible.fedoraproject.org,
      rpc_port: 8442,
      http_port: 8443,
      when: inventory_hostname == 'repospanner-osuosl01.fedoraproject.org'
    }

## The RPMs region is used to sync up pkgs from Fedora and CentOS. The
## CentOS nodes are the spawn leaders for this as they are getting data
## first.
  - { role: repospanner/server,
      node: fedora01,
      region: rpms,
      spawn_repospanner_node: true,
      rpc_port: 8444,
      http_port: 8445,
      when: inventory_hostname == 'repospanner-cc-rdu01.fedoraproject.org'
    }
  - { role: repospanner/server,
      node: fedora02,
      region: rpms,
      spawn_repospanner_node: false,
      join_repospanner_node: fedora01.rpms.fedoraproject.org,
      rpc_port: 8444,
      http_port: 8445,
      when: inventory_hostname == 'repospanner-osuosl01.fedoraproject.org'
    }
  # - { role: repospanner/server,
  #     node: fedora03,
  #     region: rpms,
  #     spawn_repospanner_node: false,
  #     join_repospanner_node: centos01.rpms.fedoraproject.org
  #     rpc_port: 8444,
  #     http_port: 8445,
  #     when: inventory_hostname == 'repospanner01.phx2.fedoraproject.org'
  #   }

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

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

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