diff --git a/azure_crowd_dc_node.yml b/azure_crowd_dc_node.yml index 693552e..f70ec6f 100644 --- a/azure_crowd_dc_node.yml +++ b/azure_crowd_dc_node.yml @@ -32,4 +32,5 @@ tags: [skip_on_stack_update] - role: crowd_config - role: azure_app_insights_install + when: (app_insights_instrumentation_key is defined) and (app_insights_instrumentation_key|length > 0) - role: product_startup diff --git a/group_vars/azure_node_local.yml b/group_vars/azure_node_local.yml index 728834c..98d3ae5 100644 --- a/group_vars/azure_node_local.yml +++ b/group_vars/azure_node_local.yml @@ -1,4 +1,6 @@ atl_jdbc_query_params_for_engine: rds_postgres: "?sslmode=require" atl_db_root_user_login: "{{ atl_db_root_user+'@'+atl_db_host if atl_db_engine == 'rds_postgres' else atl_db_root_user }}" -atl_jdbc_user_login: "{{ atl_jdbc_user+'@'+atl_db_host if atl_db_engine == 'rds_postgres' else atl_jdbc_user }}" \ No newline at end of file +atl_jdbc_user_login: "{{ atl_jdbc_user+'@'+atl_db_host if atl_db_engine == 'rds_postgres' else atl_jdbc_user }}" +oms_workspace_id: "{{ lookup('env', 'OMS_WORKSPACE_ID') }}" +oms_primary_key: "{{ lookup('env', 'OMS_PRIMARY_KEY') }}" \ No newline at end of file diff --git a/roles/azure_app_insights_install/defaults/main.yml b/roles/azure_app_insights_install/defaults/main.yml index e383cd7..8eaca54 100644 --- a/roles/azure_app_insights_install/defaults/main.yml +++ b/roles/azure_app_insights_install/defaults/main.yml @@ -1,5 +1,5 @@ --- app_insights_version: "{{ lookup('env', 'APPINSIGHTS_VER') or '2.6.0' }}" -app_insights_instrumentation_key: "{{ lookup('env', 'APPINSIGHTS_INSTRUMENTATION_KEY') or 'XXX' }}" +app_insights_instrumentation_key: "{{ lookup('env', 'APPINSIGHTS_INSTRUMENTATION_KEY') }}" app_insights_jaxb_version: 2.3.1 diff --git a/roles/azure_app_insights_install/molecule/default/playbook.yml b/roles/azure_app_insights_install/molecule/default/playbook.yml index f23b700..c57c038 100644 --- a/roles/azure_app_insights_install/molecule/default/playbook.yml +++ b/roles/azure_app_insights_install/molecule/default/playbook.yml @@ -6,6 +6,10 @@ atl_product_edition: "crowd" atl_product_user: "crowd" atl_download_format: "tarball" + atl_installer_temp: "/opt/atlassian/temp" + app_insights_instrumentation_key: "XXX" + oms_workspace_id: eae544ea-e9ea-4613-8f51-bbe2a234952e + oms_primary_key: rvNMv4enI3YGjqOJ29/Xv7nsAXDAUYmQhGfxJChmylk2dCvYLAcuTs1fVTOQ3OEHXKFjNMwwZtzKBop0KCRoBg== roles: - role: linux_common - role: azure_common diff --git a/roles/azure_app_insights_install/tasks/main.yml b/roles/azure_app_insights_install/tasks/main.yml index 58e4121..e9d8c17 100644 --- a/roles/azure_app_insights_install/tasks/main.yml +++ b/roles/azure_app_insights_install/tasks/main.yml @@ -1,9 +1,27 @@ --- -- name: Install collectd for app insights +- name: Install supporting packages for for app insights package: name: - collectd + - wget + - cron + +- name: Download OMS Agent + get_url: + url: "https://raw.githubusercontent.com/Microsoft/OMS-Agent-for-Linux/master/installer/scripts/onboard_agent.sh" + dest: "{{ atl_product_installation_versioned }}" + mode: 0755 + +- name: Check that the OMS Agent is already installed + stat: + path: /opt/microsoft/omsagent/bin/omsagent.sh + register: existing_oms_agent + +- name: Install OMS Agent + command: "{{ atl_product_installation_versioned }}/onboard_agent.sh -w {{ oms_workspace_id }} -s {{ oms_primary_key }} -d opinsights.azure.com" + when: existing_oms_agent.stat.isreg is not defined + changed_when: false # For Molecule idempotence check - name: Download Collectd App Insights jar get_url: