---

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

- name: ensure Ansible version is >= 2.9 if ADLS Gen2 is to be used
  assert:
    quiet: yes
    that: ansible_version.full is version('2.9.0', '>=')
    fail_msg: "Ansible 2.9 or above is required for using Azure ADLS Gen2 in Muchos.
      Please use the requirements.txt file to install the currently supported
      version of Ansible, and also execute the ./scripts/install-ansible-for-azure
      script to install the Ansible collection for Azure and other pre-requisites."
  when: use_adlsg2

- import_tasks: create_common_resources.yml
- import_tasks: create_adlsgen2.yml
  when: use_adlsg2
- import_tasks: create_optional_proxy.yml
- import_tasks: create_vmss.yml
  when: use_multiple_vmss is not defined or not use_multiple_vmss
- import_tasks: assign_msi_single_vmss.yml
  when: (use_multiple_vmss is not defined or not use_multiple_vmss) and use_adlsg2
- import_tasks: create_multiple_vmss.yml
  when: use_multiple_vmss
- import_tasks: assign_msi_multiple_vmss.yml
  when: use_multiple_vmss and use_adlsg2
- import_tasks: create_log_analytics_ws.yml
  when: (az_oms_integration_needed or az_use_app_insights) and (az_logs_id is not defined or (not az_logs_id) or az_logs_id == None)
- import_tasks: create_application_insights.yml
  when: az_use_app_insights
