brianloss commented on a change in pull request #414: URL: https://github.com/apache/fluo-muchos/pull/414#discussion_r739326968
########## File path: ansible/roles/azure/tasks/create_application_insights.yml ########## @@ -0,0 +1,52 @@ +--- +# +# 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: '^az_appinsights_connection_string\s*=\s*|^[#]\s*az_appinsights_connection_string\s*=\s*' + line: "az_appinsights_connection_string = {{ app_insights.response.properties.ConnectionString }}" + insertafter: '\[azure\]' Review comment: Updated in the latest commit. I changed the regex to `\[azure\]|az_app_insights_version\s*=`. insertafter uses the last match of that regex by default, so this will insert after the az_app_insights_version line if it's there (since that's in the [azure] section and therefore will be the later match). Otherwise, it will insert right after the [azure] section header. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
