---
- import_playbook: gather-facts.yml

# NOTE(mgoddard): In large environments, even tasks that are skipped can take a
# significant amount of time. This is an optimisation to prevent any tasks
# running in the subsequent plays for services that are disabled.
- name: Group hosts based on configuration
  hosts: all
  gather_facts: false
  tasks:
    - name: Group hosts based on Kolla action
      group_by:
        key: "kolla_action_{{ kolla_action }}"

    - name: Group hosts based on enabled services
      group_by:
        key: "{{ item }}"
      with_items:
        - enable_aodh_{{ enable_aodh | bool }}
        - enable_barbican_{{ enable_barbican | bool }}
        - enable_blazar_{{ enable_blazar | bool }}
        - enable_ceilometer_{{ enable_ceilometer | bool }}
        - enable_chrony_{{ enable_chrony | bool }}
        - enable_cinder_{{ enable_cinder | bool }}
        - enable_cloudkitty_{{ enable_cloudkitty | bool }}
        - enable_collectd_{{ enable_collectd | bool }}
        - enable_cyborg_{{ enable_cyborg | bool }}
        - enable_designate_{{ enable_designate | bool }}
        - enable_elasticsearch_{{ enable_elasticsearch | bool }}
        - enable_etcd_{{ enable_etcd | bool }}
        - enable_freezer_{{ enable_freezer | bool }}
        - enable_glance_{{ enable_glance | bool }}
        - enable_gnocchi_{{ enable_gnocchi | bool }}
        - enable_grafana_{{ enable_grafana | bool }}
        - enable_haproxy_{{ enable_haproxy | bool }}
        - enable_heat_{{ enable_heat | bool }}
        - enable_horizon_{{ enable_horizon | bool }}
        - enable_hyperv_{{ enable_hyperv | bool }}
        - enable_influxdb_{{ enable_influxdb | bool }}
        - enable_ironic_{{ enable_ironic | bool }}
        - enable_iscsid_{{ enable_iscsid | bool }}
        - enable_kafka_{{ enable_kafka | bool }}
        - enable_karbor_{{ enable_karbor | bool }}
        - enable_keystone_{{ enable_keystone | bool }}
        - enable_kibana_{{ enable_kibana | bool }}
        - enable_kuryr_{{ enable_kuryr | bool }}
        - enable_magnum_{{ enable_magnum | bool }}
        - enable_manila_{{ enable_manila | bool }}
        - enable_mariadb_{{ enable_mariadb | bool }}
        - enable_masakari_{{ enable_masakari | bool }}
        - enable_memcached_{{ enable_memcached | bool }}
        - enable_mistral_{{ enable_mistral | bool }}
        - enable_monasca_{{ enable_monasca | bool }}
        - enable_multipathd_{{ enable_multipathd | bool }}
        - enable_murano_{{ enable_murano | bool }}
        - enable_neutron_{{ enable_neutron | bool }}
        - enable_nova_{{ enable_nova | bool }}
        - enable_octavia_{{ enable_octavia | bool }}
        - enable_openvswitch_{{ enable_openvswitch | bool }}_enable_ovs_dpdk_{{ enable_ovs_dpdk | bool }}
        - enable_outward_rabbitmq_{{ enable_outward_rabbitmq | bool }}
        - enable_ovn_{{ enable_ovn | bool }}
        - enable_panko_{{ enable_panko | bool }}
        - enable_placement_{{ enable_placement | bool }}
        - enable_prometheus_{{ enable_prometheus | bool }}
        - enable_qdrouterd_{{ enable_qdrouterd | bool }}
        - enable_qinling_{{ enable_qinling | bool }}
        - enable_rabbitmq_{{ enable_rabbitmq | bool }}
        - enable_rally_{{ enable_rally | bool }}
        - enable_redis_{{ enable_redis | bool }}
        - enable_sahara_{{ enable_sahara | bool }}
        - enable_searchlight_{{ enable_searchlight | bool }}
        - enable_senlin_{{ enable_senlin | bool }}
        - enable_skydive_{{ enable_skydive | bool }}
        - enable_solum_{{ enable_solum | bool }}
        - enable_storm_{{ enable_storm | bool }}
        - enable_swift_{{ enable_swift | bool }}
        - enable_tacker_{{ enable_tacker | bool }}
        - enable_telegraf_{{ enable_telegraf | bool }}
        - enable_tempest_{{ enable_tempest | bool }}
        - enable_trove_{{ enable_trove | bool }}
        - enable_vitrage_{{ enable_vitrage | bool }}
        - enable_vmtp_{{ enable_vmtp | bool }}
        - enable_watcher_{{ enable_watcher | bool }}
        - enable_zookeeper_{{ enable_zookeeper | bool }}
        - enable_zun_{{ enable_zun | bool }}
  tags: always

- name: Apply role prechecks
  gather_facts: false
  # Apply only when kolla action is 'precheck'.
  hosts: kolla_action_precheck
  roles:
    - role: prechecks

- name: Apply role chrony
  gather_facts: false
  hosts:
    - chrony-server
    - chrony
    - '&enable_chrony_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: chrony,
        tags: chrony,
        when: enable_chrony | bool }

- name: Apply role haproxy
  gather_facts: false
  hosts:
    - haproxy
    - '&enable_haproxy_True'
  serial: '{{ kolla_serial|default("0") }}'
  tags:
    - haproxy
  roles:
    - { role: haproxy,
        when: enable_haproxy | bool }
  tasks:
    - block:
        - include_role:
            name: aodh
            tasks_from: loadbalancer
          tags: aodh
          when: enable_aodh | bool
        - include_role:
            name: barbican
            tasks_from: loadbalancer
          tags: barbican
          when: enable_barbican | bool
        - include_role:
            name: blazar
            tasks_from: loadbalancer
          tags: blazar
          when: enable_blazar | bool
        - include_role:
            name: cinder
            tasks_from: loadbalancer
          tags: cinder
          when: enable_cinder | bool
        - include_role:
            name: cloudkitty
            tasks_from: loadbalancer
          tags: cloudkitty
          when: enable_cloudkitty | bool
        - include_role:
            name: cyborg
            tasks_from: loadbalancer
          tags: cyborg
          when: enable_cyborg | bool
        - include_role:
            name: designate
            tasks_from: loadbalancer
          tags: designate
          when: enable_designate | bool
        - include_role:
            name: elasticsearch
            tasks_from: loadbalancer
          tags: elasticsearch
          when: enable_elasticsearch | bool
        - include_role:
            name: freezer
            tasks_from: loadbalancer
          tags: freezer
          when: enable_freezer | bool
        - include_role:
            name: glance
            tasks_from: loadbalancer
          tags: glance
          when: enable_glance | bool
        - include_role:
            name: gnocchi
            tasks_from: loadbalancer
          tags: gnocchi
          when: enable_gnocchi | bool
        - include_role:
            name: grafana
            tasks_from: loadbalancer
          tags: grafana
          when: enable_grafana | bool
        - include_role:
            name: heat
            tasks_from: loadbalancer
          tags: heat
          when: enable_heat | bool
        - include_role:
            name: horizon
            tasks_from: loadbalancer
          tags: horizon
          when: enable_horizon | bool
        - include_role:
            name: influxdb
            tasks_from: loadbalancer
          tags: influxdb
          when: enable_influxdb | bool
        - include_role:
            name: ironic
            tasks_from: loadbalancer
          tags: ironic
          when: enable_ironic | bool
        - include_role:
            name: karbor
            tasks_from: loadbalancer
          tags: karbor
          when: enable_karbor | bool
        - include_role:
            name: keystone
            tasks_from: loadbalancer
          tags: keystone
          when: enable_keystone | bool
        - include_role:
            name: kibana
            tasks_from: loadbalancer
          tags: kibana
          when: enable_kibana | bool
        - include_role:
            name: magnum
            tasks_from: loadbalancer
          tags: magnum
          when: enable_magnum | bool
        - include_role:
            name: manila
            tasks_from: loadbalancer
          tags: manila
          when: enable_manila | bool
        - include_role:
            name: mariadb
            tasks_from: loadbalancer
          tags: mariadb
          when: enable_mariadb | bool or enable_external_mariadb_load_balancer | bool
        - include_role:
            name: masakari
            tasks_from: loadbalancer
          tags: masakari
          when: enable_masakari | bool
        - include_role:
            name: memcached
            tasks_from: loadbalancer
          tags: memcached
          when: enable_memcached | bool
        - include_role:
            name: mistral
            tasks_from: loadbalancer
          tags: mistral
          when: enable_mistral | bool
        - include_role:
            name: monasca
            tasks_from: loadbalancer
          tags: monasca
          when: enable_monasca | bool
        - include_role:
            name: murano
            tasks_from: loadbalancer
          tags: murano
          when: enable_murano | bool
        - include_role:
            name: neutron
            tasks_from: loadbalancer
          tags: neutron
          when: enable_neutron | bool
        - include_role:
            name: placement
            tasks_from: loadbalancer
          tags: placement
        - include_role:
            name: nova
            tasks_from: loadbalancer
          tags:
            - nova
            - nova-api
          when: enable_nova | bool
        - include_role:
            name: nova-cell
            tasks_from: loadbalancer
          tags:
            - nova
            - nova-cell
          when: enable_nova | bool
        - include_role:
            name: octavia
            tasks_from: loadbalancer
          tags: octavia
          when: enable_octavia | bool
        - include_role:
            name: panko
            tasks_from: loadbalancer
          tags: panko
          when: enable_panko | bool
        - include_role:
            name: prometheus
            tasks_from: loadbalancer
          tags: prometheus
          when: enable_prometheus | bool
        - include_role:
            name: qinling
            tasks_from: loadbalancer
          tags: qinling
          when: enable_qinling | bool
        - include_role:
            name: rabbitmq
            tasks_from: loadbalancer
          tags: rabbitmq
          vars:
            role_rabbitmq_cluster_cookie:
            role_rabbitmq_groups:
          when: enable_rabbitmq | bool or enable_outward_rabbitmq | bool
        - include_role:
            name: sahara
            tasks_from: loadbalancer
          tags: sahara
          when: enable_sahara | bool
        - include_role:
            name: searchlight
            tasks_from: loadbalancer
          tags: searchlight
          when: enable_searchlight | bool
        - include_role:
            name: senlin
            tasks_from: loadbalancer
          tags: senlin
          when: enable_senlin | bool
        - include_role:
            name: skydive
            tasks_from: loadbalancer
          tags: skydive
          when: enable_skydive | bool
        - include_role:
            name: solum
            tasks_from: loadbalancer
          tags: solum
          when: enable_solum | bool
        - include_role:
            name: swift
            tasks_from: loadbalancer
          tags: swift
          when: enable_swift | bool
        - include_role:
            name: tacker
            tasks_from: loadbalancer
          tags: tacker
          when: enable_tacker | bool
        - include_role:
            name: trove
            tasks_from: loadbalancer
          tags: trove
          when: enable_trove | bool
        - include_role:
            name: vitrage
            tasks_from: loadbalancer
          tags: vitrage
          when: enable_vitrage | bool
        - include_role:
            name: watcher
            tasks_from: loadbalancer
          tags: watcher
          when: enable_watcher | bool
        - include_role:
            name: zun
            tasks_from: loadbalancer
          tags: zun
          when: enable_zun | bool
      when:
        - enable_haproxy | bool
        - kolla_action in ['deploy', 'reconfigure', 'upgrade', 'config']

- name: Apply role collectd
  gather_facts: false
  hosts:
    - collectd
    - '&enable_collectd_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: collectd,
        tags: collectd,
        when: enable_collectd | bool }

- name: Apply role zookeeper
  gather_facts: false
  hosts:
    - zookeeper
    - '&enable_zookeeper_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: zookeeper,
        tags: zookeeper,
        when: enable_zookeeper | bool }

- name: Apply role elasticsearch
  gather_facts: false
  hosts:
    - elasticsearch
    - '&enable_elasticsearch_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: elasticsearch,
        tags: elasticsearch,
        when: enable_elasticsearch | bool }

- name: Apply role influxdb
  gather_facts: false
  hosts:
    - influxdb
    - '&enable_influxdb_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: influxdb,
        tags: influxdb,
        when: enable_influxdb | bool }

- name: Apply role telegraf
  gather_facts: false
  hosts:
    - telegraf
    - '&enable_telegraf_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: telegraf,
        tags: telegraf,
        when: enable_telegraf | bool }

- name: Apply role redis
  gather_facts: false
  hosts:
    - redis
    - '&enable_redis_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: redis,
        tags: redis,
        when: enable_redis | bool }

- name: Apply role kibana
  gather_facts: false
  hosts:
    - kibana
    - '&enable_kibana_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: kibana,
        tags: kibana,
        when: enable_kibana | bool }

- name: Apply role mariadb
  gather_facts: false
  hosts:
    - mariadb
    - '&enable_mariadb_True'
  roles:
    - { role: mariadb,
        tags: mariadb,
        when: enable_mariadb | bool }

- name: Apply role memcached
  gather_facts: false
  hosts:
    - memcached
    - '&enable_memcached_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: memcached,
        tags: [memcache, memcached],
        when: enable_memcached | bool }

- name: Apply role prometheus
  gather_facts: false
  hosts:
    - prometheus
    - prometheus-node-exporter
    - prometheus-mysqld-exporter
    - prometheus-haproxy-exporter
    - prometheus-cadvisor
    - prometheus-alertmanager
    - prometheus-openstack-exporter
    - prometheus-elasticsearch-exporter
    - prometheus-blackbox-exporter
    - '&enable_prometheus_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: prometheus,
        tags: prometheus,
        when: enable_prometheus | bool }

- name: Apply role iscsi
  gather_facts: false
  hosts:
    - iscsid
    - tgtd
    - '&enable_iscsid_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: iscsi,
        tags: iscsi,
        when: enable_iscsid | bool }

- name: Apply role multipathd
  gather_facts: false
  hosts:
    - multipathd
    - '&enable_multipathd_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: multipathd,
        tags: multipathd,
        when: enable_multipathd | bool }

- name: Apply role rabbitmq
  gather_facts: false
  hosts:
    - rabbitmq
    - '&enable_rabbitmq_True'
  roles:
    - { role: rabbitmq,
        tags: rabbitmq,
        role_rabbitmq_cluster_cookie: '{{ rabbitmq_cluster_cookie }}',
        role_rabbitmq_cluster_port: '{{ rabbitmq_cluster_port }}',
        role_rabbitmq_epmd_port: '{{ rabbitmq_epmd_port }}',
        role_rabbitmq_groups: rabbitmq,
        role_rabbitmq_management_port: '{{ rabbitmq_management_port }}',
        role_rabbitmq_monitoring_password: '{{ rabbitmq_monitoring_password }}',
        role_rabbitmq_monitoring_user: '{{ rabbitmq_monitoring_user }}',
        role_rabbitmq_password: '{{ rabbitmq_password }}',
        role_rabbitmq_port: '{{ rabbitmq_port }}',
        role_rabbitmq_user: '{{ rabbitmq_user }}',
        when: enable_rabbitmq | bool }

- name: Apply role rabbitmq (outward)
  gather_facts: false
  hosts:
    - outward-rabbitmq
    - '&enable_outward_rabbitmq_True'
  roles:
    - { role: rabbitmq,
        tags: rabbitmq,
        project_name: outward_rabbitmq,
        role_rabbitmq_cluster_cookie: '{{ outward_rabbitmq_cluster_cookie }}',
        role_rabbitmq_cluster_port: '{{ outward_rabbitmq_cluster_port }}',
        role_rabbitmq_epmd_port: '{{ outward_rabbitmq_epmd_port }}',
        role_rabbitmq_groups: outward-rabbitmq,
        role_rabbitmq_management_port: '{{ outward_rabbitmq_management_port }}',
        role_rabbitmq_password: '{{ outward_rabbitmq_password }}',
        role_rabbitmq_port: '{{ outward_rabbitmq_port }}',
        role_rabbitmq_user: '{{ outward_rabbitmq_user }}',
        when: enable_outward_rabbitmq | bool }

- name: Apply role qdrouterd
  gather_facts: false
  hosts:
    - qdrouterd
    - '&enable_qdrouterd_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: qdrouterd,
        tags: qdrouterd,
        when: enable_qdrouterd | bool }

- name: Apply role etcd
  gather_facts: false
  hosts:
    - etcd
    - '&enable_etcd_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: etcd,
        tags: etcd,
        when: enable_etcd | bool }

- name: Apply role keystone
  gather_facts: false
  hosts:
    - keystone
    - '&enable_keystone_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: keystone,
        tags: keystone,
        when: enable_keystone | bool }

- name: Apply role kafka
  gather_facts: false
  hosts:
    - kafka
    - '&enable_kafka_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: kafka,
        tags: kafka,
        when: enable_kafka | bool }

- name: Apply role storm
  gather_facts: false
  hosts:
    - storm-worker
    - storm-nimbus
    - '&enable_storm_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: storm,
        tags: storm,
        when: enable_storm | bool }

- name: Apply role karbor
  gather_facts: false
  hosts:
    - karbor
    - '&enable_karbor_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: karbor,
        tags: karbor,
        when: enable_karbor | bool }

- name: Apply role swift
  gather_facts: false
  hosts:
    - swift-account-server
    - swift-container-server
    - swift-object-server
    - swift-proxy-server
    - '&enable_swift_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: swift,
        tags: swift,
        when: enable_swift | bool }

- name: Apply role glance
  gather_facts: false
  hosts:
    - glance-api
    - '&enable_glance_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: glance,
        tags: glance,
        when: enable_glance | bool }

- name: Apply role ironic
  gather_facts: false
  hosts:
    - ironic-api
    - ironic-conductor
    - ironic-inspector
    - ironic-pxe
    - '&enable_ironic_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: ironic,
        tags: ironic,
        when: enable_ironic | bool }

- name: Apply role cinder
  gather_facts: false
  hosts:
    - cinder-api
    - cinder-backup
    - cinder-scheduler
    - cinder-volume
    - '&enable_cinder_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: cinder,
        tags: cinder,
        when: enable_cinder | bool }

- name: Apply role placement
  gather_facts: false
  hosts:
    - placement-api
    - '&enable_placement_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: placement,
        tags: placement,
        when: enable_placement | bool }

# Nova deployment is more complicated than other services, so is covered in its
# own playbook.
- import_playbook: nova.yml

- name: Apply role openvswitch
  gather_facts: false
  hosts:
    - openvswitch
    - '&enable_openvswitch_True_enable_ovs_dpdk_False'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: openvswitch,
        tags: openvswitch,
        when: "(enable_openvswitch | bool) and not (enable_ovs_dpdk | bool)"}

- name: Apply role ovs-dpdk
  gather_facts: false
  hosts:
    - openvswitch
    - '&enable_openvswitch_True_enable_ovs_dpdk_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: ovs-dpdk,
        tags: ovs-dpdk,
        when: "(enable_openvswitch | bool) and (enable_ovs_dpdk | bool)"}

- name: Apply role ovn
  gather_facts: false
  hosts:
    - ovn-controller
    - ovn-nb-db
    - ovn-northd
    - ovn-sb-db
    - '&enable_ovn_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: ovn,
        tags: ovn,
        when: enable_ovn | bool }

- name: Apply role nova-hyperv
  gather_facts: false
  hosts:
    - hyperv
    - '&enable_hyperv_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: nova-hyperv,
        tags: nova-hyperv,
        when: enable_hyperv | bool }

# NOTE(gmmaha): Please do not change the order listed here. The current order is a
# workaround to fix the bug https://bugs.launchpad.net/kolla/+bug/1546789
- name: Apply role neutron
  gather_facts: false
  hosts:
    - neutron-server
    - neutron-dhcp-agent
    - neutron-l3-agent
    - ironic-neutron-agent
    - neutron-metadata-agent
    - neutron-ovn-metadata-agent
    - neutron-metering-agent
    - compute
    - manila-share
    - '&enable_neutron_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: neutron,
        tags: neutron,
        when: enable_neutron | bool }

- name: Apply role kuryr
  gather_facts: false
  hosts:
    - compute
    - '&enable_kuryr_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: kuryr,
        tags: kuryr,
        when: enable_kuryr | bool }

- name: Apply role heat
  gather_facts: false
  hosts:
    - heat-api
    - heat-api-cfn
    - heat-engine
    - '&enable_heat_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: heat,
        tags: heat,
        when: enable_heat | bool }

- name: Apply role horizon
  gather_facts: false
  hosts:
    - horizon
    - '&enable_horizon_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: horizon,
        tags: horizon,
        when: enable_horizon | bool }

- name: Apply role murano
  gather_facts: false
  hosts:
    - murano-api
    - murano-engine
    - '&enable_murano_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: murano,
        tags: murano,
        when: enable_murano | bool }

- name: Apply role solum
  gather_facts: false
  hosts:
    - solum-api
    - solum-worker
    - solum-deployer
    - solum-conductor
    - '&enable_solum_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: solum,
        tags: solum,
        when: enable_solum | bool }

- name: Apply role magnum
  gather_facts: false
  hosts:
    - magnum-api
    - magnum-conductor
    - '&enable_magnum_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: magnum,
        tags: magnum,
        when: enable_magnum | bool }

- name: Apply role mistral
  gather_facts: false
  hosts:
    - mistral-api
    - mistral-engine
    - mistral-executor
    - '&enable_mistral_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: mistral,
        tags: mistral,
        when: enable_mistral | bool }

- name: Apply role qinling
  gather_facts: false
  hosts:
    - qinling-api
    - qinling-engine
    - '&enable_qinling_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: qinling,
        tags: qinling,
        when: enable_qinling | bool }

- name: Apply role sahara
  gather_facts: false
  hosts:
    - sahara-api
    - sahara-engine
    - '&enable_sahara_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: sahara,
        tags: sahara,
        when: enable_sahara | bool }

- name: Apply role panko
  gather_facts: false
  hosts:
    - panko-api
    - '&enable_panko_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: panko,
        tags: panko,
        when: enable_panko | bool }

- name: Apply role manila
  gather_facts: false
  hosts:
    - manila-api
    - manila-data
    - manila-share
    - manila-scheduler
    - '&enable_manila_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: manila,
        tags: manila,
        when: enable_manila | bool }

- name: Apply role gnocchi
  gather_facts: false
  hosts:
    - gnocchi-api
    - gnocchi-metricd
    - gnocchi-statsd
    - '&enable_gnocchi_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: gnocchi,
        tags: gnocchi,
        when: enable_gnocchi | bool }

- name: Apply role ceilometer
  gather_facts: false
  vars_files:
    - "roles/panko/defaults/main.yml"
  hosts:
    - ceilometer-central
    - ceilometer-notification
    - ceilometer-compute
    - ceilometer-ipmi
    - '&enable_ceilometer_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: ceilometer,
        tags: ceilometer,
        when: enable_ceilometer | bool }

- name: Apply role monasca
  gather_facts: false
  hosts:
    - monasca
    - monasca-agent
    - monasca-api
    - monasca-grafana
    - monasca-log-transformer
    - monasca-log-persister
    - monasca-log-metrics
    - monasca-thresh
    - monasca-notification
    - monasca-persister
    - '&enable_monasca_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: monasca,
        tags: monasca,
        when: enable_monasca | bool }

- name: Apply role aodh
  gather_facts: false
  hosts:
    - aodh-api
    - aodh-evaluator
    - aodh-listener
    - aodh-notifier
    - '&enable_aodh_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: aodh,
        tags: aodh,
        when: enable_aodh | bool }

- name: Apply role barbican
  gather_facts: false
  hosts:
    - barbican-api
    - barbican-keystone-listener
    - barbican-worker
    - '&enable_barbican_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: barbican,
        tags: barbican,
        when: enable_barbican | bool }

- name: Apply role cyborg
  gather_facts: false
  hosts:
    - cyborg
    - '&enable_cyborg_True'
  serial: '{{ serial|default("0") }}'
  roles:
    - { role: cyborg,
        tags: cyborg,
        when: enable_cyborg | bool }

- name: Apply role tempest
  gather_facts: false
  hosts:
    - tempest
    - '&enable_tempest_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: tempest,
        tags: tempest,
        when: enable_tempest | bool }

- name: Apply role designate
  gather_facts: false
  hosts:
    - designate-api
    - designate-central
    - designate-producer
    - designate-mdns
    - designate-worker
    - designate-sink
    - designate-backend-bind9
    - '&enable_designate_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: designate,
        tags: designate,
        when: enable_designate | bool }

- name: Apply role rally
  gather_facts: false
  hosts:
    - rally
    - '&enable_rally_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: rally,
        tags: rally,
        when: enable_rally | bool }

- name: Apply role vmtp
  gather_facts: false
  hosts:
    - vmtp
    - '&enable_vmtp_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: vmtp,
        tags: vmtp,
        when: enable_vmtp | bool }

- name: Apply role trove
  gather_facts: false
  hosts:
    - trove-api
    - trove-conductor
    - trove-taskmanager
    - '&enable_trove_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: trove,
        tags: trove,
        when: enable_trove | bool }

- name: Apply role watcher
  gather_facts: false
  hosts:
    - watcher-api
    - watcher-engine
    - watcher-applier
    - '&enable_watcher_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: watcher,
        tags: watcher,
        when: enable_watcher | bool }

- name: Apply role grafana
  gather_facts: false
  hosts:
    - grafana
    - '&enable_grafana_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: grafana,
        tags: grafana,
        when: enable_grafana | bool }

- name: Apply role cloudkitty
  gather_facts: false
  hosts:
    - cloudkitty-api
    - cloudkitty-processor
    - '&enable_cloudkitty_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: cloudkitty,
        tags: cloudkitty,
        when: enable_cloudkitty | bool }

- name: Apply role freezer
  gather_facts: false
  hosts:
    - freezer-api
    - freezer-scheduler
    - '&enable_freezer_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: freezer,
        tags: freezer,
        when: enable_freezer | bool }

- name: Apply role senlin
  gather_facts: false
  hosts:
    - senlin-api
    - senlin-conductor
    - senlin-engine
    - senlin-health-manager
    - '&enable_senlin_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: senlin,
        tags: senlin,
        when: enable_senlin | bool }

- name: Apply role searchlight
  gather_facts: false
  hosts:
    - searchlight-api
    - searchlight-listener
    - '&enable_searchlight_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: searchlight,
        tags: searchlight,
        when: enable_searchlight | bool }

- name: Apply role tacker
  gather_facts: false
  hosts:
    - tacker-server
    - tacker-conductor
    - '&enable_tacker_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: tacker,
        tags: tacker,
        when: enable_tacker | bool }

- name: Apply role octavia
  gather_facts: false
  hosts:
    - octavia-api
    - octavia-health-manager
    - octavia-housekeeping
    - octavia-worker
    - '&enable_octavia_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: octavia,
        tags: octavia,
        when: enable_octavia | bool }

- name: Apply role zun
  gather_facts: false
  hosts:
    - zun-api
    - zun-wsproxy
    - zun-compute
    - zun-cni-daemon
    - '&enable_zun_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: zun,
        tags: zun,
        when: enable_zun | bool }

- name: Apply role skydive
  gather_facts: false
  hosts:
    - skydive-agent
    - skydive-analyzer
    - '&enable_skydive_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: skydive,
        tags: skydive,
        when: enable_skydive | bool }

- name: Apply role vitrage
  gather_facts: false
  hosts:
    - vitrage-api
    - vitrage-graph
    - vitrage-notifier
    - vitrage-ml
    - '&enable_vitrage_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: vitrage,
        tags: vitrage,
        when: enable_vitrage | bool }

- name: Apply role blazar
  gather_facts: false
  hosts:
    - blazar-api
    - blazar-manager
    - '&enable_blazar_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: blazar,
        tags: blazar,
        when: enable_blazar | bool }

- name: Apply role masakari
  gather_facts: false
  hosts:
    - masakari-api
    - masakari-engine
    - masakari-monitors
    - '&enable_masakari_True'
  serial: '{{ kolla_serial|default("0") }}'
  roles:
    - { role: masakari,
        tags: masakari,
        when: enable_masakari | bool }