| --- |
| # |
| # 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. |
| # |
| # |
| # These Ansible tasks only run on the client machine where Muchos runs |
| # At a high level, the various sections in this file do the following: |
| # 1. Create an Azure Application Insights resource. |
| # 2. Update the az_appinsights_connection_string property in muchos.props |
| |
| - import_tasks: log_analytics_ws_common.yml |
| - import_tasks: application_insights_common.yml |
| |
| - name: Create Application Insights resource using REST API |
| azure_rm_resource: |
| resource_group: "{{ resource_group }}" |
| provider: insights |
| resource_type: components |
| resource_name: "{{ app_insights_name }}" |
| api_version: "2020-02-02" |
| idempotency: yes |
| state: present |
| body: |
| location: "{{ location }}" |
| kind: java |
| properties: |
| ApplicationId: "{{ app_insights_name }}" |
| Application_Type: other |
| Flow_Type: Bluefield |
| Request_Source: rest |
| WorkspaceResourceId: "{{ az_logs_resource_id if az_logs_resource_id else az_logs_ws_resource_id }}" |
| register: app_insights |
| |
| - name: Update az_appinsights_connection_string in muchos.props |
| lineinfile: |
| path: "{{ deploy_path }}/conf/muchos.props" |
| regexp: '^\s*[#]?\s*az_appinsights_connection_string\s*=' |
| line: "az_appinsights_connection_string = {{ app_insights.response.properties.ConnectionString }}" |
| insertafter: '\[azure\]|az_app_insights_version\s*=' |