- hosts: localhost
  roles:
    - role: emit-job-header
      zuul_log_url: "http://logs.openstack.org"

- hosts: all
  pre_tasks:
    # NOTE(pabelanger): Until we hit the validate-host role, we have a minimal
    # set of ansible variables collected by zuul-executor. This doesn't include
    # network variables (ansible_default_ipv4 / ansible_default_ipv6) so gather
    # these variables as they are important to the configure-unbound role.
    - name: Gather network facts
      setup:
        gather_subset: 'network'

  roles:
    - add-build-sshkey
    - start-zuul-console
    - log-inventory

- hosts: all
  roles:
    # NOTE(pabelanger): We run this role in its own play to ensure unbound is
    # restarted before proceeding with any other role. This is because we use
    # notify / handler to restart the unbound service. With ansible notify
    # actions are triggered at the end of each block of tasks in a play.
    - configure-unbound

- hosts: all
  roles:
    - validate-host
    - use-cached-repos
    - test-mirror-workspace-git-repos
    - mirror-info
    - role: configure-mirrors
      set_apt_mirrors_trusted: True
    - role: fetch-zuul-cloner
      destination: "/usr/zuul-env/bin/zuul-cloner"
      repo_src_dir: "/home/zuul/src/git.openstack.org"

- hosts: localhost
  roles:
    - role: emit-job-header
      zuul_log_url: "http://logs.openstack.org"

- hosts: all
  pre_tasks:
    # NOTE(pabelanger): Until we hit the validate-host role, we have a minimal
    # set of ansible variables collected by zuul-executor. This doesn't include
    # network variables (ansible_default_ipv4 / ansible_default_ipv6) so gather
    # these variables as they are important to the configure-unbound role.
    - name: Gather network facts
      setup:
        gather_subset: 'network'

  roles:
    - add-build-sshkey
    - start-zuul-console
    - log-inventory

- hosts: all
  roles:
    # NOTE(pabelanger): We run this role in its own play to ensure unbound is
    # restarted before proceeding with any other role. This is because we use
    # notify / handler to restart the unbound service. With ansible notify
    # actions are triggered at the end of each block of tasks in a play.
    - configure-unbound

- hosts: all
  roles:
    - validate-host
    - use-cached-repos
    - test-mirror-workspace-git-repos
    - mirror-info
    - role: configure-mirrors
      set_apt_mirrors_trusted: True
    - role: fetch-zuul-cloner
      destination: "/usr/zuul-env/bin/zuul-cloner"
      repo_src_dir: "/home/zuul/src/git.openstack.org"

  pre_tasks:
    - name: Check that regional mirror is online
      uri:
        url: "http://{{ zuul_site_mirror_fqdn }}"

Check that regional mirror is online
base-test: Check that regional mirror is online

It is possible for our regional mirror to be offline, for some random
reason. If so, fail the job in pre, so zuul will retry the job
(hopefully in a different region).

Change-Id: I9bd9e551930e5fb88bf9bb3156c59568cee3fa89
Signed-off-by: Paul Belanger <e7139c8e6c4ea75cc1c287ce081b2dc0f3ab39ec@redhat.com>
