Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new monitor diagnostic setting modules #701

Merged
merged 18 commits into from
Dec 24, 2021

Conversation

l3ender
Copy link
Contributor

@l3ender l3ender commented Nov 25, 2021

SUMMARY

This PR adds support for configuring diagnostic settings for any Azure resource. Log and/or metric information from the resource can be sent to a variety of destinations.

An example which sends log information from an app service to an event hub:

- name: Create diagnostic setting for webapp to an event hub
  azure_rm_monitordiagnosticsetting:
    name: "webapp-logs"
    resource:
      name: "my-webapp"
      type: "Microsoft.Web/sites"
      resource_group: "my-webapp-resource-group"
    event_hub:
      namespace: "my-event-hub"
      policy: "RootManageSharedAccessKey"
    logs:
      - category: "AppServiceConsoleLogs"
      - category: "AppServiceAppLogs"

Fixes #529.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

azure_rm_monitordiagnosticsetting
azure_rm_monitordiagnosticsetting_info

ADDITIONAL INFORMATION

I have added extensive test coverage, which can be run using a playbook like the following:

---
- name: "Playbook for testing."
  hosts: "localhost"
  connection: "local"
  gather_facts: false
  vars:
    resource_group: "automated-testing"
    resource_group_secondary: "automated-testing-secondary"
  collections:
    - azure.azcollection

  tasks:
    - name: "Include tests"
      include_tasks: "tests/integration/targets/azure_rm_monitordiagnosticsetting/tasks/main.yml"

@l3ender
Copy link
Contributor Author

l3ender commented Nov 25, 2021

Hi @Fred-sun, here is a module which I think will be very helpful for people. I saw #530 addressed the same issue, but the PR was quite stale and did not offer much flexibility. So I have raised this PR and hope it will be useful.

Please review and advise--thank you!

@l3ender l3ender changed the title Add monitor diagnostic setting modules Add new monitor diagnostic setting modules Nov 25, 2021
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l3ender A lot of normative questions about module documentation, Please refer to the link - https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html#developing-modules-documen ting

Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l3ender The return value suboption paramter is "contain", not suboptions. Thank you!

plugins/modules/azure_rm_monitordiagnosticsetting_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_monitordiagnosticsetting.py Outdated Show resolved Hide resolved
l3ender and others added 2 commits November 26, 2021 10:43
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
@l3ender
Copy link
Contributor Author

l3ender commented Nov 26, 2021

Thanks for the review, @Fred-sun, and sorry for the silly documentation syntax mistakes. Thanks for providing the URL for detail on how to generate documentation; I will be looking more into that.

Please take another look. Thank you!

@Fred-sun Fred-sun added medium_priority Medium priority new_module_pr Add new modules ready_for_review The PR has been modified and can be reviewed and merged labels Nov 29, 2021
@l3ender
Copy link
Contributor Author

l3ender commented Dec 6, 2021

Hello, wondering if there is anything else I can do for this PR? Thank you!

@Fred-sun
Copy link
Collaborator

Fred-sun commented Dec 7, 2021

Hello, wondering if there is anything else I can do for this PR? Thank you!

@l3ender We are reviewing and will push forward the merger as soon as possible. Thank you very much!

@l3ender
Copy link
Contributor Author

l3ender commented Dec 23, 2021

Hello, is anything else desired for this PR? Thank you!

@xuzhang3
Copy link
Collaborator

@l3ender LGTM, shipping it.

@xuzhang3 xuzhang3 merged commit c00aebe into ansible-collections:dev Dec 24, 2021
@xuzhang3 xuzhang3 deleted the diagnostic-settings branch December 24, 2021 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority new_module_pr Add new modules ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new module for diagnostic settings
3 participants