Add changes according to inclusion discussion (#18)
* Updating modules * updating CI tests * Fixing module issue * testing * Fixing notes issue * Last fixes * adding spaces * Fixed changelog * Update ci test on condition Co-authored-by: Ishan Jain <ishan.jain@gmail.com>
This commit is contained in:
parent
893e8e4025
commit
0bd1a17de9
4
.github/workflows/ci-test.yml
vendored
4
.github/workflows/ci-test.yml
vendored
@ -1,6 +1,8 @@
|
||||
name: CI Tests
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
@ -15,8 +17,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
ansible:
|
||||
- stable-2.9
|
||||
- stable-2.10
|
||||
- stable-2.11
|
||||
- stable-2.12
|
||||
- stable-2.13
|
||||
|
8
.github/workflows/full-integration-test.yml
vendored
8
.github/workflows/full-integration-test.yml
vendored
@ -17,8 +17,6 @@ jobs:
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
ansible:
|
||||
- stable-2.9
|
||||
- stable-2.10
|
||||
- stable-2.11
|
||||
- stable-2.12
|
||||
- stable-2.13
|
||||
@ -32,12 +30,6 @@ jobs:
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
exclude:
|
||||
- ansible: stable-2.9
|
||||
python: '3.9'
|
||||
- ansible: stable-2.9
|
||||
python: '3.10'
|
||||
- ansible: stable-2.10
|
||||
python: '3.10'
|
||||
- ansible: stable-2.11
|
||||
python: '3.10'
|
||||
|
||||
|
103
.github/workflows/release.yml
vendored
Normal file
103
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
name: GitHub Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version number to release'
|
||||
required: true
|
||||
env:
|
||||
NAMESPACE: grafana
|
||||
COLLECTION_NAME: grafana
|
||||
|
||||
jobs:
|
||||
sanity:
|
||||
name: Sanity (Ⓐ${{ matrix.ansible }})
|
||||
strategy:
|
||||
matrix:
|
||||
ansible:
|
||||
- stable-2.11
|
||||
- stable-2.12
|
||||
- stable-2.13
|
||||
- devel
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-base (${{ matrix.ansible }})
|
||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Run sanity tests
|
||||
run: ansible-test sanity --docker -v --color --coverage
|
||||
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
||||
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
name: Integration (Ⓐ${{ matrix.ansible }}-py${{ matrix.python }})
|
||||
strategy:
|
||||
fail-fast: true
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
ansible:
|
||||
- stable-2.13
|
||||
python:
|
||||
- '3.10'
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
||||
|
||||
- name: create integration_config
|
||||
working-directory: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/integration
|
||||
run: |
|
||||
cat <<EOF > integration_config.yml
|
||||
stack_name: ${{ secrets.ANSIBLE_TEST_STACK_NAME }}
|
||||
org_name: ${{ secrets.ANSIBLE_TEST_ORG_NAME }}
|
||||
grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }}
|
||||
grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }}
|
||||
EOF
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: Install ansible-base (${{ matrix.ansible }})
|
||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Run integration test
|
||||
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
|
||||
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
||||
|
||||
release:
|
||||
name: Create GitHub Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.10
|
||||
|
||||
- name: Install PyYaml
|
||||
run: pip install pyyaml
|
||||
|
||||
- name: Validate version is published to Galaxy
|
||||
run: curl --head -s -f -o /dev/null https://galaxy.ansible.com/download/grafana-grafana${{ github.event.inputs.version }}.tar.gz
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.version }}
|
@ -4,6 +4,16 @@ Grafana.Grafana Release Notes
|
||||
|
||||
.. contents:: Topics
|
||||
|
||||
v1.0.3
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- Add a fail method to modules source code if `requests` library is not present
|
||||
- Fixed markup for arg option in Documenation
|
||||
- Updated Documenation with `notes` to specify if the check_mode feature is supported by modules
|
||||
- removed `supports_check_mode=True` from source code of modules
|
||||
|
||||
v1.0.2
|
||||
======
|
||||
@ -11,7 +21,7 @@ v1.0.2
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
- Documentation updates with updated description for modules.
|
||||
Documentation updates with updated description for modules
|
||||
|
||||
v1.0.1
|
||||
======
|
||||
@ -19,8 +29,7 @@ v1.0.1
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
- Documentation updates with updated examples.
|
||||
|
||||
Documentation updates with updated examples
|
||||
|
||||
v1.0.0
|
||||
======
|
||||
@ -28,8 +37,7 @@ v1.0.0
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
- CI and testing improvements.
|
||||
|
||||
CI and testing improvements
|
||||
|
||||
v0.0.7
|
||||
======
|
||||
@ -37,10 +45,9 @@ v0.0.7
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
- Documentation update for return values in `grafana.grafana.dashboard` module.
|
||||
Documentation update for return values in `grafana.grafana.dashboard` module
|
||||
|
||||
|
||||
v0.6.0
|
||||
v0.0.6
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
@ -48,8 +55,7 @@ Minor Changes
|
||||
|
||||
- Idempotency updates to cloud_api_key and datasource modules
|
||||
|
||||
|
||||
v0.5.0
|
||||
v0.0.5
|
||||
======
|
||||
|
||||
Release Summary
|
||||
@ -57,7 +63,7 @@ Release Summary
|
||||
|
||||
Documenation update and code cleanup
|
||||
|
||||
v0.4.0
|
||||
v0.0.4
|
||||
======
|
||||
|
||||
Bugfixes
|
||||
@ -65,7 +71,7 @@ Bugfixes
|
||||
|
||||
- Fix an issue with `cloud_stack` idempotency
|
||||
|
||||
v0.3.0
|
||||
v0.0.3
|
||||
======
|
||||
|
||||
Release Summary
|
||||
@ -73,7 +79,7 @@ Release Summary
|
||||
|
||||
Documenation update and code cleanup
|
||||
|
||||
v0.2.0
|
||||
v0.0.2
|
||||
======
|
||||
|
||||
Release Summary
|
||||
@ -88,15 +94,3 @@ Release Summary
|
||||
---------------
|
||||
|
||||
It's a release! First version to publish to Ansible Galaxy.
|
||||
|
||||
New Modules
|
||||
-----------
|
||||
|
||||
- alert_contact_point - Manage Alerting Contact points in Grafana.
|
||||
- alert_notification_policy - Sets the notification policy tree in Grafana Alerting
|
||||
- cloud_api_key - Manage Grafana Cloud API keys
|
||||
- cloud_plugin - Configures a SQL Agent job step.
|
||||
- cloud_stack - Manage Grafana Cloud Plugins.
|
||||
- dashboard - Manage Dashboards in Grafana
|
||||
- datasource - Manage Data sources in Grafana
|
||||
- folder - Manage Folders in Grafana
|
||||
|
@ -1,5 +1,4 @@
|
||||
objects:
|
||||
role: {}
|
||||
objects: {}
|
||||
plugins:
|
||||
become: {}
|
||||
cache: {}
|
||||
@ -54,4 +53,4 @@ plugins:
|
||||
shell: {}
|
||||
strategy: {}
|
||||
vars: {}
|
||||
version: 1.0.2
|
||||
version: 1.0.3
|
||||
|
@ -1,10 +1,50 @@
|
||||
ancestor: null
|
||||
releases:
|
||||
0.0.1:
|
||||
changes:
|
||||
release_summary: It's a release! First version to publish to Ansible Galaxy.
|
||||
0.0.2:
|
||||
changes:
|
||||
release_summary: Updated input parameters description for all modules
|
||||
0.0.3:
|
||||
changes:
|
||||
release_summary: Documenation update and code cleanup
|
||||
0.0.4:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Fix an issue with `cloud_stack` idempotency
|
||||
0.0.5:
|
||||
changes:
|
||||
release_summary: Documenation update and code cleanup
|
||||
0.0.6:
|
||||
changes:
|
||||
minor_changes:
|
||||
- Idempotency updates to cloud_api_key and datasource modules
|
||||
0.0.7:
|
||||
changes:
|
||||
release_summary: Documentation update for return values in `grafana.grafana.dashboard`
|
||||
module
|
||||
release_date: '2022-08-11'
|
||||
1.0.0:
|
||||
changes:
|
||||
release_summary: CI and testing improvements
|
||||
release_date: '2022-08-16'
|
||||
1.0.1:
|
||||
changes:
|
||||
release_summary: Documentation updates with updated examples
|
||||
release_date: '2022-08-23'
|
||||
1.0.2:
|
||||
changes:
|
||||
release_summary: Documentation updates with updated description for modules
|
||||
release_date: '2022-08-30'
|
||||
1.0.3:
|
||||
changes:
|
||||
minor_changes:
|
||||
- Add a fail method to modules source code if `requests` library is not present
|
||||
- Fixed markup for arg option in Documenation
|
||||
- Updated Documenation with `notes` to specify if the check_mode feature is
|
||||
supported by modules
|
||||
- removed `supports_check_mode=True` from source code of modules
|
||||
release_date: '2022-10-20'
|
||||
1.0.4:
|
||||
release_date: '2022-10-20'
|
||||
|
@ -16,6 +16,8 @@ short_description: Manage Alerting Contact points in Grafana Cloud
|
||||
description:
|
||||
- Create, Update and delete Contact points using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
@ -39,7 +41,7 @@ options:
|
||||
required: true
|
||||
disableResolveMessage:
|
||||
description:
|
||||
- When set to True, Disables the resolve message [OK] that is sent when alerting state returns to false.
|
||||
- When set to C(true), Disables the resolve message [OK] that is sent when alerting state returns to C(false).
|
||||
type: bool
|
||||
default: false
|
||||
grafana_api_key:
|
||||
@ -88,30 +90,37 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
output:
|
||||
description: Dict object containing Contact point information information
|
||||
description: Dict object containing Contact point information information.
|
||||
returned: On success
|
||||
type: dict
|
||||
contains:
|
||||
disableResolveMessage:
|
||||
description: When set to True, Disables the resolve message [OK] that is sent when alerting state returns to false
|
||||
description: When set to True, Disables the resolve message [OK] that is sent when alerting state returns to false.
|
||||
returned: state is present and on success
|
||||
type: bool
|
||||
sample: false
|
||||
name:
|
||||
description: The name for the contact point
|
||||
description: The name for the contact point.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: ops-email
|
||||
settings:
|
||||
description: Contains contact point settings
|
||||
description: Contains contact point settings.
|
||||
returned: state is present and on success
|
||||
type: dict
|
||||
sample: {
|
||||
addresses: "ops@mydomain.com,devs@mydomain.com"
|
||||
}
|
||||
uid:
|
||||
description: The UID for the contact point
|
||||
description: The UID for the contact point.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: opsemail
|
||||
type:
|
||||
description: The type of contact point
|
||||
description: The type of contact point.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: email
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -200,10 +209,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
@ -16,10 +16,12 @@ short_description: Sets the notification policy tree in Alerting on Grafana Clou
|
||||
description:
|
||||
- Set the notification policy tree using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
Continue:
|
||||
description:
|
||||
- Continue matching subsequent sibling nodes if set to `True`.
|
||||
- Continue matching subsequent sibling nodes if set to C(true).
|
||||
type: bool
|
||||
default: false
|
||||
groupByStr:
|
||||
@ -117,7 +119,7 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
output:
|
||||
description: Dict object containing Notification tree information
|
||||
description: Dict object containing Notification tree information.
|
||||
returned: On success
|
||||
type: dict
|
||||
contains:
|
||||
@ -125,22 +127,38 @@ output:
|
||||
description: The waiting time to send a batch of new alerts for that group after the first notification was sent. This is of the parent policy.
|
||||
returned: on success
|
||||
type: str
|
||||
sample: "5m"
|
||||
group_wait:
|
||||
description: The waiting time until the initial notification is sent for a new group created by an incoming alert. This is of the parent policy.
|
||||
returned: on success
|
||||
type: str
|
||||
sample: "30s"
|
||||
receiver:
|
||||
description: The name of the default contact point
|
||||
description: The name of the default contact point.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "grafana-default-email"
|
||||
repeat_interval:
|
||||
description: The waiting time to resend an alert after they have successfully been sent. This is of the parent policy
|
||||
returned: on success
|
||||
type: str
|
||||
sample: "4h"
|
||||
routes:
|
||||
description: The entire notification tree returned as a list
|
||||
description: The entire notification tree returned as a list.
|
||||
returned: on success
|
||||
type: list
|
||||
sample: [
|
||||
{
|
||||
"object_matchers": [
|
||||
[
|
||||
"env",
|
||||
"=",
|
||||
"Production"
|
||||
]
|
||||
],
|
||||
"receiver": "grafana-default-email"
|
||||
}
|
||||
]
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -174,6 +192,7 @@ def alert_notification_policy(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(Continue=dict(type='bool', required=False, default=False),
|
||||
groupByStr=dict(type='list', required=False, default=[], elements='str'),
|
||||
muteTimeIntervals=dict(type='list', required=False, default=[], elements='str'),
|
||||
@ -186,7 +205,10 @@ def main():
|
||||
stack_slug=dict(type='str', required=True),
|
||||
grafana_api_key=dict(type='str', required=True, no_log=True), )
|
||||
|
||||
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)
|
||||
module = AnsibleModule(argument_spec=module_args)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = alert_notification_policy(module)
|
||||
|
||||
|
@ -16,6 +16,8 @@ short_description: Manage Grafana Cloud API keys
|
||||
description:
|
||||
- Create and delete Grafana Cloud API keys using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
@ -24,7 +26,7 @@ options:
|
||||
required: true
|
||||
role:
|
||||
description:
|
||||
- Sets the role to be associated with the CLoud API key.
|
||||
- Sets the role to be associated with the Cloud API key.
|
||||
type: str
|
||||
required: true
|
||||
choices: [Admin, Viewer, Editor, MetricsPublisher]
|
||||
@ -40,7 +42,7 @@ options:
|
||||
required : true
|
||||
fail_if_already_created:
|
||||
description:
|
||||
- If set to `True`, the task will fail if the API key with same name already exists in the Organization.
|
||||
- If set to C(true), the task will fail if the API key with same name already exists in the Organization.
|
||||
type: bool
|
||||
default: True
|
||||
state:
|
||||
@ -110,6 +112,7 @@ def absent_cloud_api_key(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(
|
||||
name=dict(type='str', required=True),
|
||||
role=dict(type='str', required=True, choices=['Admin', 'Viewer', 'Editor', 'MetricsPublisher']),
|
||||
@ -125,10 +128,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
@ -16,6 +16,8 @@ short_description: Manage Grafana Cloud Plugins
|
||||
description:
|
||||
- Create, Update and delete Grafana Cloud stacks using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
@ -64,25 +66,30 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
current_version:
|
||||
description: Current version of the plugin
|
||||
description: Current version of the plugin.
|
||||
returned: On success
|
||||
type: str
|
||||
sample: "1.0.14"
|
||||
latest_version:
|
||||
description: Latest version available for the plugin
|
||||
description: Latest version available for the plugin.
|
||||
returned: On success
|
||||
type: str
|
||||
sample: "1.0.15"
|
||||
pluginId:
|
||||
description: Id for the Plugin
|
||||
description: Id for the Plugin.
|
||||
returned: On success
|
||||
type: int
|
||||
sample: 663
|
||||
pluginName:
|
||||
description: Name of the plugin
|
||||
description: Name of the plugin.
|
||||
returned: On success
|
||||
type: str
|
||||
sample: "GitHub"
|
||||
pluginSlug:
|
||||
description: Slug for the Plugin
|
||||
description: Slug for the Plugin.
|
||||
returned: On success
|
||||
type: str
|
||||
sample: "grafana-github-datasource"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -130,6 +137,7 @@ def absent_cloud_plugin(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(
|
||||
name=dict(type='str', required=True),
|
||||
version=dict(type='str', required=False, default='latest'),
|
||||
@ -144,10 +152,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
@ -16,15 +16,17 @@ short_description: Manage Grafana Cloud stack
|
||||
description:
|
||||
- Create and delete Grafana Cloud stacks using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Sets the name of stack. Conventionally matches the URL of the instance. For example, "<stack_slug>.grafana.net".
|
||||
- Sets the name of stack. Conventionally matches the URL of the instance. For example, C(stackslug.grafana.net).
|
||||
type: str
|
||||
required: true
|
||||
stack_slug:
|
||||
description:
|
||||
- Sets the subdomain of the Grafana instance. For example, if slug is <stack_slug>, the instance URL will be `https://<stack_slug>.grafana.net`.
|
||||
- Sets the subdomain of the Grafana instance. For example, if slug is B(stackslug), the instance URL will be C(https://stackslug.grafana.net).
|
||||
type: str
|
||||
required: true
|
||||
cloud_api_key:
|
||||
@ -40,7 +42,7 @@ options:
|
||||
choices: [ us, us-azure, eu, au, eu-azure, prod-ap-southeast-0, prod-gb-south-0, prod-eu-west-3]
|
||||
url:
|
||||
description:
|
||||
- If you use a custom domain for the instance, you can provide it here. If not provided, Will be set to `https://<stack_slug>.grafana.net`.
|
||||
- If you use a custom domain for the instance, you can provide it here. If not provided, Will be set to C(https://stackslug.grafana.net).
|
||||
type: str
|
||||
org_slug:
|
||||
description:
|
||||
@ -77,41 +79,50 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
alertmanager_name:
|
||||
description: Name of the alertmanager instance
|
||||
description: Name of the alertmanager instance.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "stackname-alerts"
|
||||
alertmanager_url:
|
||||
description: URL of the alertmanager instance
|
||||
description: URL of the alertmanager instance.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "https://alertmanager-eu-west-0.grafana.net"
|
||||
cluster_slug:
|
||||
description: Slug for the cluster where the Grafana stack is deployed
|
||||
description: Slug for the cluster where the Grafana stack is deployed.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "prod-eu-west-0"
|
||||
id:
|
||||
description: ID of the Grafana Cloud stack
|
||||
description: ID of the Grafana Cloud stack.
|
||||
returned: always
|
||||
type: int
|
||||
sample: 458182
|
||||
loki_url:
|
||||
description: URl for the Loki instance
|
||||
description: URl for the Loki instance.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "https://logs-prod-eu-west-0.grafana.net"
|
||||
orgID:
|
||||
description: ID of the Grafana Cloud organization
|
||||
description: ID of the Grafana Cloud organization.
|
||||
returned: always
|
||||
type: int
|
||||
sample: 652992
|
||||
prometheus_url:
|
||||
description: URl for the Prometheus instance
|
||||
description: URl for the Prometheus instance.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "https://prometheus-prod-01-eu-west-0.grafana.net"
|
||||
tempo_url:
|
||||
description: URl for the Tempo instance
|
||||
description: URl for the Tempo instance.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "https://tempo-eu-west-0.grafana.net"
|
||||
url:
|
||||
description: URL of the Grafana Cloud stack
|
||||
description: URL of the Grafana Cloud stack.
|
||||
returned: always
|
||||
type: str
|
||||
sample: "https://stackname.grafana.net"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -165,6 +176,7 @@ def absent_cloud_stack(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(
|
||||
name=dict(type='str', required=True),
|
||||
stack_slug=dict(type='str', required=True),
|
||||
@ -183,10 +195,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
@ -16,6 +16,8 @@ short_description: Manage Dashboards in Grafana Cloud
|
||||
description:
|
||||
- Create, Update and delete Dashboards using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
dashboard:
|
||||
description:
|
||||
@ -58,42 +60,50 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
output:
|
||||
description: Dict object containing folder information
|
||||
description: Dict object containing folder information.
|
||||
returned: On success
|
||||
type: dict
|
||||
contains:
|
||||
id:
|
||||
description: The ID for the dashboard
|
||||
description: The ID for the dashboard.
|
||||
returned: on success
|
||||
type: int
|
||||
sample: 17
|
||||
slug:
|
||||
description: The slug for the dashboard
|
||||
description: The slug for the dashboard.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: ansible-integration-test
|
||||
status:
|
||||
description: The status of the dashboard
|
||||
description: The status of the dashboard.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: success
|
||||
uid:
|
||||
description: The UID for the dashboard
|
||||
description: The UID for the dashboard.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "test1234"
|
||||
url:
|
||||
description: The endpoint for the dashboard
|
||||
description: The endpoint for the dashboard.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "/d/test1234/ansible-integration-test"
|
||||
version:
|
||||
description: The version of the dashboard
|
||||
description: The version of the dashboard.
|
||||
returned: state is present and on success
|
||||
type: int
|
||||
sample: 2
|
||||
message:
|
||||
description: The message returned after the operation on the dashboard
|
||||
description: The message returned after the operation on the dashboard.
|
||||
returned: state is absent and on success
|
||||
type: str
|
||||
sample: "Dashboard Ansible Integration Test deleted"
|
||||
title:
|
||||
description: The name of the dashboard
|
||||
description: The name of the dashboard.
|
||||
returned: state is absent and on success
|
||||
type: str
|
||||
sample: "Ansible Integration Test"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -134,6 +144,7 @@ def absent_dashboard(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(
|
||||
dashboard=dict(type='dict', required=True),
|
||||
stack_slug=dict(type='str', required=True),
|
||||
@ -147,10 +158,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
@ -16,6 +16,8 @@ short_description: Manage Data sources in Grafana Cloud
|
||||
description:
|
||||
- Create, Update and delete Data sources using Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
dataSource:
|
||||
description:
|
||||
@ -58,7 +60,7 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
output:
|
||||
description: Dict object containing Data source information
|
||||
description: Dict object containing Data source information.
|
||||
returned: On success
|
||||
type: dict
|
||||
contains:
|
||||
@ -66,18 +68,43 @@ output:
|
||||
description: The response body content for the data source configuration.
|
||||
returned: state is present and on success
|
||||
type: dict
|
||||
sample: {
|
||||
"access": "proxy",
|
||||
"basicAuth": false,
|
||||
"basicAuthUser": "",
|
||||
"database": "db-name",
|
||||
"id": 20,
|
||||
"isDefault": false,
|
||||
"jsonData": {},
|
||||
"name": "ansible-integration",
|
||||
"orgId": 1,
|
||||
"readOnly": false,
|
||||
"secureJsonFields": {
|
||||
"password": true
|
||||
},
|
||||
"type": "influxdb",
|
||||
"typeLogoUrl": "",
|
||||
"uid": "ansibletest",
|
||||
"url": "https://grafana.github.com/grafana-ansible-collection",
|
||||
"user": "user",
|
||||
"version": 1,
|
||||
"withCredentials": false
|
||||
}
|
||||
id:
|
||||
description: The ID assigned to the data source
|
||||
description: The ID assigned to the data source.
|
||||
returned: on success
|
||||
type: int
|
||||
sample: 20
|
||||
name:
|
||||
description: The name of the data source defined in the JSON source code
|
||||
description: The name of the data source defined in the JSON source code.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "ansible-integration"
|
||||
message:
|
||||
description: The message returned after the operation on the Data source
|
||||
description: The message returned after the operation on the Data source.
|
||||
returned: on success
|
||||
type: str
|
||||
sample: "Datasource added"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -126,6 +153,7 @@ def absent_datasource(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(
|
||||
dataSource=dict(type='dict', required=True),
|
||||
stack_slug=dict(type='str', required=True),
|
||||
@ -139,10 +167,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
@ -16,6 +16,8 @@ short_description: Manage Folders in Grafana Cloud
|
||||
description:
|
||||
- Create, Update and delete Folders via Ansible.
|
||||
requirements: [ "requests >= 1.0.0" ]
|
||||
notes:
|
||||
- Does not support C(check_mode).
|
||||
options:
|
||||
title:
|
||||
description:
|
||||
@ -29,7 +31,7 @@ options:
|
||||
required: true
|
||||
overwrite:
|
||||
description:
|
||||
- Set to false if you dont want to overwrite existing folder with newer version.
|
||||
- Set to C(false) if you dont want to overwrite existing folder with newer version.
|
||||
type: bool
|
||||
required: false
|
||||
default: true
|
||||
@ -71,70 +73,85 @@ EXAMPLES = '''
|
||||
|
||||
RETURN = r'''
|
||||
output:
|
||||
description: Dict object containing folder information
|
||||
description: Dict object containing folder information.
|
||||
returned: On success
|
||||
type: dict
|
||||
contains:
|
||||
canAdmin:
|
||||
description: Boolean value specifying if current user can admin in folder
|
||||
description: Boolean value specifying if current user can admin in folder.
|
||||
returned: state is present and on success
|
||||
type: bool
|
||||
sample: true
|
||||
canDelete:
|
||||
description: Boolean value specifying if current user can delete the folder
|
||||
description: Boolean value specifying if current user can delete the folder.
|
||||
returned: state is present and on success
|
||||
type: bool
|
||||
sample: true
|
||||
canEdit:
|
||||
description: Boolean value specifying if current user can edit in folder
|
||||
description: Boolean value specifying if current user can edit in folder.
|
||||
returned: state is present and on success
|
||||
type: bool
|
||||
sample: true
|
||||
canSave:
|
||||
description: Boolean value specifying if current user can save in folder
|
||||
description: Boolean value specifying if current user can save in folder.
|
||||
returned: state is present and on success
|
||||
type: bool
|
||||
sample: true
|
||||
created:
|
||||
description: The date when folder was created
|
||||
description: The date when folder was created.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "2022-10-20T09:31:53Z"
|
||||
createdBy:
|
||||
description: The name of the user who created the folder
|
||||
description: The name of the user who created the folder.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "Anonymous"
|
||||
hasAcl:
|
||||
description: Boolean value specifying if folder has acl
|
||||
description: Boolean value specifying if folder has acl.
|
||||
returned: state is present and on success
|
||||
type: bool
|
||||
sample: true
|
||||
id:
|
||||
description: The ID for the folder
|
||||
description: The ID for the folder.
|
||||
returned: on success
|
||||
type: int
|
||||
sample: 18
|
||||
title:
|
||||
description: The name of the folder
|
||||
description: The name of the folder.
|
||||
returned: on success
|
||||
type: str
|
||||
sample: foldername
|
||||
uid:
|
||||
description: The UID for the folder
|
||||
description: The UID for the folder.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: foldername
|
||||
updated:
|
||||
description: The date when the folder was last updated
|
||||
description: The date when the folder was last updated.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "2022-10-20T09:31:53Z"
|
||||
updatedBy:
|
||||
description: The name of the user who last updated the folder
|
||||
description: The name of the user who last updated the folder.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "Anonymous"
|
||||
url:
|
||||
description: The URl for the folder
|
||||
description: The URl for the folder.
|
||||
returned: state is present and on success
|
||||
type: str
|
||||
sample: "/dashboards/f/foldername/foldername"
|
||||
version:
|
||||
description: The version of the folder
|
||||
description: The version of the folder.
|
||||
returned: state is present and on success
|
||||
type: int
|
||||
sample: 1
|
||||
message:
|
||||
description: The message returned after the operation on the folder
|
||||
description: The message returned after the operation on the folder.
|
||||
returned: state is absent and on success
|
||||
type: str
|
||||
sample: "Folder foldername deleted"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@ -189,6 +206,7 @@ def absent_folder(module):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module_args = dict(
|
||||
title=dict(type='str', required=True),
|
||||
uid=dict(type='str', required=True),
|
||||
@ -204,10 +222,12 @@ def main():
|
||||
}
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
argument_spec=module_args
|
||||
)
|
||||
|
||||
if not HAS_REQUESTS:
|
||||
module.fail_json("Missing package - `request` ")
|
||||
|
||||
is_error, has_changed, result = choice_map.get(
|
||||
module.params['state'])(module)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user