- hosts: all
  tasks:
    - name: Run gate-check-commit.sh script
      become: yes
      become_user: root
      shell: >-
        scripts/gate-check-commit.sh {{ scenario }} {{ action }} {{ install_method }}
      args:
        chdir: "src/opendev.org/openstack/openstack-ansible"
        executable: /bin/bash
      environment:
        # ZUUL_SRC_PATH is used by tests/get-ansible-role-requirements to
        # where the CI provided git sources were cloned.
        ZUUL_SRC_PATH: "{{ ansible_user_dir }}/src"
        ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}"

- hosts: all
  vars:
    scenario_map:
      aodh: telemetry
      ceilometer: telemetry
      gnocchi: telemetry
      horizon: lxc
  tasks:
    - name: Dynamically determine additional scenario elements
      when:
        - zuul.project.short_name is match("^openstack-ansible-os_(.*)$")
        - (dynamic_scenario | default(True)) | bool
      block:
        - name: Set service_name
          set_fact:
            service_name: "{{ zuul.project.short_name | regex_replace('^openstack-ansible-os_(.*)$', '\\1') }}"

        - name: Set scenario_suffix
          set_fact:
            scenario_suffix: "{{ scenario_map[service_name] | default(service_name) }}"

        # Horizon's apache uses the same ip:port combinations as
        # the repo server's nginx service. As such, we force the
        # use of containers to ensure that they do not conflict.
        - name: Add services based on test repo name
          set_fact:
            scenario: "{{ (service_name == 'horizon') | ternary(scenario | regex_replace('_metal', ''), scenario) }}_{{ scenario_suffix }}"

    - name: Run gate-check-commit.sh script
      become: yes
      become_user: root
      shell: >-
        scripts/gate-check-commit.sh {{ scenario }} {{ action }} {{ install_method }}
      args:
        chdir: "src/opendev.org/openstack/openstack-ansible"
        executable: /bin/bash
      environment:
        # ZUUL_SRC_PATH is used by tests/get-ansible-role-requirements to
        # where the CI provided git sources were cloned.
        ZUUL_SRC_PATH: "{{ ansible_user_dir }}/src"
        ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}"

Add services for testing based on test repo name
Add services for testing based on test repo name

Rather than have to define a job per non-aio service, we have
zuul introspect the origin test repo and add the service name
to the scenario variable on the fly. This allows us to simplify
our job definitions and simply use the AIO job template for all
repositories.

Change-Id: I592d51171ecef5e30c54e71bf4c00d96787bce36
