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
|
name: CI Tests
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
pull_request:
|
pull_request:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 6 * * *'
|
- cron: '0 6 * * *'
|
||||||
@ -15,8 +17,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.9
|
|
||||||
- stable-2.10
|
|
||||||
- stable-2.11
|
- stable-2.11
|
||||||
- stable-2.12
|
- stable-2.12
|
||||||
- stable-2.13
|
- 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
|
max-parallel: 1
|
||||||
matrix:
|
matrix:
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.9
|
|
||||||
- stable-2.10
|
|
||||||
- stable-2.11
|
- stable-2.11
|
||||||
- stable-2.12
|
- stable-2.12
|
||||||
- stable-2.13
|
- stable-2.13
|
||||||
@ -32,12 +30,6 @@ jobs:
|
|||||||
- '3.9'
|
- '3.9'
|
||||||
- '3.10'
|
- '3.10'
|
||||||
exclude:
|
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
|
- ansible: stable-2.11
|
||||||
python: '3.10'
|
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
|
.. 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
|
v1.0.2
|
||||||
======
|
======
|
||||||
@ -11,7 +21,7 @@ v1.0.2
|
|||||||
Release Summary
|
Release Summary
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
- Documentation updates with updated description for modules.
|
Documentation updates with updated description for modules
|
||||||
|
|
||||||
v1.0.1
|
v1.0.1
|
||||||
======
|
======
|
||||||
@ -19,8 +29,7 @@ v1.0.1
|
|||||||
Release Summary
|
Release Summary
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
- Documentation updates with updated examples.
|
Documentation updates with updated examples
|
||||||
|
|
||||||
|
|
||||||
v1.0.0
|
v1.0.0
|
||||||
======
|
======
|
||||||
@ -28,8 +37,7 @@ v1.0.0
|
|||||||
Release Summary
|
Release Summary
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
- CI and testing improvements.
|
CI and testing improvements
|
||||||
|
|
||||||
|
|
||||||
v0.0.7
|
v0.0.7
|
||||||
======
|
======
|
||||||
@ -37,10 +45,9 @@ v0.0.7
|
|||||||
Release Summary
|
Release Summary
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
- Documentation update for return values in `grafana.grafana.dashboard` module.
|
Documentation update for return values in `grafana.grafana.dashboard` module
|
||||||
|
|
||||||
|
v0.0.6
|
||||||
v0.6.0
|
|
||||||
======
|
======
|
||||||
|
|
||||||
Minor Changes
|
Minor Changes
|
||||||
@ -48,8 +55,7 @@ Minor Changes
|
|||||||
|
|
||||||
- Idempotency updates to cloud_api_key and datasource modules
|
- Idempotency updates to cloud_api_key and datasource modules
|
||||||
|
|
||||||
|
v0.0.5
|
||||||
v0.5.0
|
|
||||||
======
|
======
|
||||||
|
|
||||||
Release Summary
|
Release Summary
|
||||||
@ -57,7 +63,7 @@ Release Summary
|
|||||||
|
|
||||||
Documenation update and code cleanup
|
Documenation update and code cleanup
|
||||||
|
|
||||||
v0.4.0
|
v0.0.4
|
||||||
======
|
======
|
||||||
|
|
||||||
Bugfixes
|
Bugfixes
|
||||||
@ -65,7 +71,7 @@ Bugfixes
|
|||||||
|
|
||||||
- Fix an issue with `cloud_stack` idempotency
|
- Fix an issue with `cloud_stack` idempotency
|
||||||
|
|
||||||
v0.3.0
|
v0.0.3
|
||||||
======
|
======
|
||||||
|
|
||||||
Release Summary
|
Release Summary
|
||||||
@ -73,7 +79,7 @@ Release Summary
|
|||||||
|
|
||||||
Documenation update and code cleanup
|
Documenation update and code cleanup
|
||||||
|
|
||||||
v0.2.0
|
v0.0.2
|
||||||
======
|
======
|
||||||
|
|
||||||
Release Summary
|
Release Summary
|
||||||
@ -88,15 +94,3 @@ Release Summary
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
It's a release! First version to publish to Ansible Galaxy.
|
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:
|
objects: {}
|
||||||
role: {}
|
|
||||||
plugins:
|
plugins:
|
||||||
become: {}
|
become: {}
|
||||||
cache: {}
|
cache: {}
|
||||||
@ -54,4 +53,4 @@ plugins:
|
|||||||
shell: {}
|
shell: {}
|
||||||
strategy: {}
|
strategy: {}
|
||||||
vars: {}
|
vars: {}
|
||||||
version: 1.0.2
|
version: 1.0.3
|
||||||
|
@ -1,10 +1,50 @@
|
|||||||
ancestor: null
|
ancestor: null
|
||||||
releases:
|
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:
|
0.0.7:
|
||||||
|
changes:
|
||||||
|
release_summary: Documentation update for return values in `grafana.grafana.dashboard`
|
||||||
|
module
|
||||||
release_date: '2022-08-11'
|
release_date: '2022-08-11'
|
||||||
1.0.0:
|
1.0.0:
|
||||||
|
changes:
|
||||||
|
release_summary: CI and testing improvements
|
||||||
release_date: '2022-08-16'
|
release_date: '2022-08-16'
|
||||||
1.0.1:
|
1.0.1:
|
||||||
|
changes:
|
||||||
|
release_summary: Documentation updates with updated examples
|
||||||
release_date: '2022-08-23'
|
release_date: '2022-08-23'
|
||||||
1.0.2:
|
1.0.2:
|
||||||
|
changes:
|
||||||
|
release_summary: Documentation updates with updated description for modules
|
||||||
release_date: '2022-08-30'
|
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:
|
description:
|
||||||
- Create, Update and delete Contact points using Ansible.
|
- Create, Update and delete Contact points using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
@ -39,7 +41,7 @@ options:
|
|||||||
required: true
|
required: true
|
||||||
disableResolveMessage:
|
disableResolveMessage:
|
||||||
description:
|
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
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
grafana_api_key:
|
grafana_api_key:
|
||||||
@ -88,30 +90,37 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
output:
|
output:
|
||||||
description: Dict object containing Contact point information information
|
description: Dict object containing Contact point information information.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: dict
|
type: dict
|
||||||
contains:
|
contains:
|
||||||
disableResolveMessage:
|
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
|
returned: state is present and on success
|
||||||
type: bool
|
type: bool
|
||||||
|
sample: false
|
||||||
name:
|
name:
|
||||||
description: The name for the contact point
|
description: The name for the contact point.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: ops-email
|
||||||
settings:
|
settings:
|
||||||
description: Contains contact point settings
|
description: Contains contact point settings.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: dict
|
type: dict
|
||||||
|
sample: {
|
||||||
|
addresses: "ops@mydomain.com,devs@mydomain.com"
|
||||||
|
}
|
||||||
uid:
|
uid:
|
||||||
description: The UID for the contact point
|
description: The UID for the contact point.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: opsemail
|
||||||
type:
|
type:
|
||||||
description: The type of contact point
|
description: The type of contact point.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: email
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -200,10 +209,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
@ -16,10 +16,12 @@ short_description: Sets the notification policy tree in Alerting on Grafana Clou
|
|||||||
description:
|
description:
|
||||||
- Set the notification policy tree using Ansible.
|
- Set the notification policy tree using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
Continue:
|
Continue:
|
||||||
description:
|
description:
|
||||||
- Continue matching subsequent sibling nodes if set to `True`.
|
- Continue matching subsequent sibling nodes if set to C(true).
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
groupByStr:
|
groupByStr:
|
||||||
@ -117,7 +119,7 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
output:
|
output:
|
||||||
description: Dict object containing Notification tree information
|
description: Dict object containing Notification tree information.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: dict
|
type: dict
|
||||||
contains:
|
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.
|
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
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "5m"
|
||||||
group_wait:
|
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.
|
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
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "30s"
|
||||||
receiver:
|
receiver:
|
||||||
description: The name of the default contact point
|
description: The name of the default contact point.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "grafana-default-email"
|
||||||
repeat_interval:
|
repeat_interval:
|
||||||
description: The waiting time to resend an alert after they have successfully been sent. This is of the parent policy
|
description: The waiting time to resend an alert after they have successfully been sent. This is of the parent policy
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "4h"
|
||||||
routes:
|
routes:
|
||||||
description: The entire notification tree returned as a list
|
description: The entire notification tree returned as a list.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: list
|
type: list
|
||||||
|
sample: [
|
||||||
|
{
|
||||||
|
"object_matchers": [
|
||||||
|
[
|
||||||
|
"env",
|
||||||
|
"=",
|
||||||
|
"Production"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"receiver": "grafana-default-email"
|
||||||
|
}
|
||||||
|
]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -174,6 +192,7 @@ def alert_notification_policy(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(Continue=dict(type='bool', required=False, default=False),
|
module_args = dict(Continue=dict(type='bool', required=False, default=False),
|
||||||
groupByStr=dict(type='list', required=False, default=[], elements='str'),
|
groupByStr=dict(type='list', required=False, default=[], elements='str'),
|
||||||
muteTimeIntervals=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),
|
stack_slug=dict(type='str', required=True),
|
||||||
grafana_api_key=dict(type='str', required=True, no_log=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)
|
is_error, has_changed, result = alert_notification_policy(module)
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ short_description: Manage Grafana Cloud API keys
|
|||||||
description:
|
description:
|
||||||
- Create and delete Grafana Cloud API keys using Ansible.
|
- Create and delete Grafana Cloud API keys using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
@ -24,7 +26,7 @@ options:
|
|||||||
required: true
|
required: true
|
||||||
role:
|
role:
|
||||||
description:
|
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
|
type: str
|
||||||
required: true
|
required: true
|
||||||
choices: [Admin, Viewer, Editor, MetricsPublisher]
|
choices: [Admin, Viewer, Editor, MetricsPublisher]
|
||||||
@ -40,7 +42,7 @@ options:
|
|||||||
required : true
|
required : true
|
||||||
fail_if_already_created:
|
fail_if_already_created:
|
||||||
description:
|
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
|
type: bool
|
||||||
default: True
|
default: True
|
||||||
state:
|
state:
|
||||||
@ -110,6 +112,7 @@ def absent_cloud_api_key(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(
|
module_args = dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
role=dict(type='str', required=True, choices=['Admin', 'Viewer', 'Editor', 'MetricsPublisher']),
|
role=dict(type='str', required=True, choices=['Admin', 'Viewer', 'Editor', 'MetricsPublisher']),
|
||||||
@ -125,10 +128,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ short_description: Manage Grafana Cloud Plugins
|
|||||||
description:
|
description:
|
||||||
- Create, Update and delete Grafana Cloud stacks using Ansible.
|
- Create, Update and delete Grafana Cloud stacks using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
@ -64,25 +66,30 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
current_version:
|
current_version:
|
||||||
description: Current version of the plugin
|
description: Current version of the plugin.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "1.0.14"
|
||||||
latest_version:
|
latest_version:
|
||||||
description: Latest version available for the plugin
|
description: Latest version available for the plugin.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "1.0.15"
|
||||||
pluginId:
|
pluginId:
|
||||||
description: Id for the Plugin
|
description: Id for the Plugin.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: int
|
type: int
|
||||||
|
sample: 663
|
||||||
pluginName:
|
pluginName:
|
||||||
description: Name of the plugin
|
description: Name of the plugin.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "GitHub"
|
||||||
pluginSlug:
|
pluginSlug:
|
||||||
description: Slug for the Plugin
|
description: Slug for the Plugin.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "grafana-github-datasource"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -130,6 +137,7 @@ def absent_cloud_plugin(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(
|
module_args = dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
version=dict(type='str', required=False, default='latest'),
|
version=dict(type='str', required=False, default='latest'),
|
||||||
@ -144,10 +152,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
@ -16,15 +16,17 @@ short_description: Manage Grafana Cloud stack
|
|||||||
description:
|
description:
|
||||||
- Create and delete Grafana Cloud stacks using Ansible.
|
- Create and delete Grafana Cloud stacks using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
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
|
type: str
|
||||||
required: true
|
required: true
|
||||||
stack_slug:
|
stack_slug:
|
||||||
description:
|
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
|
type: str
|
||||||
required: true
|
required: true
|
||||||
cloud_api_key:
|
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]
|
choices: [ us, us-azure, eu, au, eu-azure, prod-ap-southeast-0, prod-gb-south-0, prod-eu-west-3]
|
||||||
url:
|
url:
|
||||||
description:
|
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
|
type: str
|
||||||
org_slug:
|
org_slug:
|
||||||
description:
|
description:
|
||||||
@ -77,41 +79,50 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
alertmanager_name:
|
alertmanager_name:
|
||||||
description: Name of the alertmanager instance
|
description: Name of the alertmanager instance.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "stackname-alerts"
|
||||||
alertmanager_url:
|
alertmanager_url:
|
||||||
description: URL of the alertmanager instance
|
description: URL of the alertmanager instance.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "https://alertmanager-eu-west-0.grafana.net"
|
||||||
cluster_slug:
|
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
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "prod-eu-west-0"
|
||||||
id:
|
id:
|
||||||
description: ID of the Grafana Cloud stack
|
description: ID of the Grafana Cloud stack.
|
||||||
returned: always
|
returned: always
|
||||||
type: int
|
type: int
|
||||||
|
sample: 458182
|
||||||
loki_url:
|
loki_url:
|
||||||
description: URl for the Loki instance
|
description: URl for the Loki instance.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "https://logs-prod-eu-west-0.grafana.net"
|
||||||
orgID:
|
orgID:
|
||||||
description: ID of the Grafana Cloud organization
|
description: ID of the Grafana Cloud organization.
|
||||||
returned: always
|
returned: always
|
||||||
type: int
|
type: int
|
||||||
|
sample: 652992
|
||||||
prometheus_url:
|
prometheus_url:
|
||||||
description: URl for the Prometheus instance
|
description: URl for the Prometheus instance.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "https://prometheus-prod-01-eu-west-0.grafana.net"
|
||||||
tempo_url:
|
tempo_url:
|
||||||
description: URl for the Tempo instance
|
description: URl for the Tempo instance.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "https://tempo-eu-west-0.grafana.net"
|
||||||
url:
|
url:
|
||||||
description: URL of the Grafana Cloud stack
|
description: URL of the Grafana Cloud stack.
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
|
sample: "https://stackname.grafana.net"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -165,6 +176,7 @@ def absent_cloud_stack(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(
|
module_args = dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
stack_slug=dict(type='str', required=True),
|
stack_slug=dict(type='str', required=True),
|
||||||
@ -183,10 +195,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ short_description: Manage Dashboards in Grafana Cloud
|
|||||||
description:
|
description:
|
||||||
- Create, Update and delete Dashboards using Ansible.
|
- Create, Update and delete Dashboards using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
dashboard:
|
dashboard:
|
||||||
description:
|
description:
|
||||||
@ -58,42 +60,50 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
output:
|
output:
|
||||||
description: Dict object containing folder information
|
description: Dict object containing folder information.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: dict
|
type: dict
|
||||||
contains:
|
contains:
|
||||||
id:
|
id:
|
||||||
description: The ID for the dashboard
|
description: The ID for the dashboard.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: int
|
type: int
|
||||||
|
sample: 17
|
||||||
slug:
|
slug:
|
||||||
description: The slug for the dashboard
|
description: The slug for the dashboard.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: ansible-integration-test
|
||||||
status:
|
status:
|
||||||
description: The status of the dashboard
|
description: The status of the dashboard.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: success
|
||||||
uid:
|
uid:
|
||||||
description: The UID for the dashboard
|
description: The UID for the dashboard.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "test1234"
|
||||||
url:
|
url:
|
||||||
description: The endpoint for the dashboard
|
description: The endpoint for the dashboard.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "/d/test1234/ansible-integration-test"
|
||||||
version:
|
version:
|
||||||
description: The version of the dashboard
|
description: The version of the dashboard.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: int
|
type: int
|
||||||
|
sample: 2
|
||||||
message:
|
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
|
returned: state is absent and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "Dashboard Ansible Integration Test deleted"
|
||||||
title:
|
title:
|
||||||
description: The name of the dashboard
|
description: The name of the dashboard.
|
||||||
returned: state is absent and on success
|
returned: state is absent and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "Ansible Integration Test"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -134,6 +144,7 @@ def absent_dashboard(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(
|
module_args = dict(
|
||||||
dashboard=dict(type='dict', required=True),
|
dashboard=dict(type='dict', required=True),
|
||||||
stack_slug=dict(type='str', required=True),
|
stack_slug=dict(type='str', required=True),
|
||||||
@ -147,10 +158,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ short_description: Manage Data sources in Grafana Cloud
|
|||||||
description:
|
description:
|
||||||
- Create, Update and delete Data sources using Ansible.
|
- Create, Update and delete Data sources using Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
dataSource:
|
dataSource:
|
||||||
description:
|
description:
|
||||||
@ -58,7 +60,7 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
output:
|
output:
|
||||||
description: Dict object containing Data source information
|
description: Dict object containing Data source information.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: dict
|
type: dict
|
||||||
contains:
|
contains:
|
||||||
@ -66,18 +68,43 @@ output:
|
|||||||
description: The response body content for the data source configuration.
|
description: The response body content for the data source configuration.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: dict
|
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:
|
id:
|
||||||
description: The ID assigned to the data source
|
description: The ID assigned to the data source.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: int
|
type: int
|
||||||
|
sample: 20
|
||||||
name:
|
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
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "ansible-integration"
|
||||||
message:
|
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
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "Datasource added"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -126,6 +153,7 @@ def absent_datasource(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(
|
module_args = dict(
|
||||||
dataSource=dict(type='dict', required=True),
|
dataSource=dict(type='dict', required=True),
|
||||||
stack_slug=dict(type='str', required=True),
|
stack_slug=dict(type='str', required=True),
|
||||||
@ -139,10 +167,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ short_description: Manage Folders in Grafana Cloud
|
|||||||
description:
|
description:
|
||||||
- Create, Update and delete Folders via Ansible.
|
- Create, Update and delete Folders via Ansible.
|
||||||
requirements: [ "requests >= 1.0.0" ]
|
requirements: [ "requests >= 1.0.0" ]
|
||||||
|
notes:
|
||||||
|
- Does not support C(check_mode).
|
||||||
options:
|
options:
|
||||||
title:
|
title:
|
||||||
description:
|
description:
|
||||||
@ -29,7 +31,7 @@ options:
|
|||||||
required: true
|
required: true
|
||||||
overwrite:
|
overwrite:
|
||||||
description:
|
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
|
type: bool
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
@ -71,70 +73,85 @@ EXAMPLES = '''
|
|||||||
|
|
||||||
RETURN = r'''
|
RETURN = r'''
|
||||||
output:
|
output:
|
||||||
description: Dict object containing folder information
|
description: Dict object containing folder information.
|
||||||
returned: On success
|
returned: On success
|
||||||
type: dict
|
type: dict
|
||||||
contains:
|
contains:
|
||||||
canAdmin:
|
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
|
returned: state is present and on success
|
||||||
type: bool
|
type: bool
|
||||||
|
sample: true
|
||||||
canDelete:
|
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
|
returned: state is present and on success
|
||||||
type: bool
|
type: bool
|
||||||
|
sample: true
|
||||||
canEdit:
|
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
|
returned: state is present and on success
|
||||||
type: bool
|
type: bool
|
||||||
|
sample: true
|
||||||
canSave:
|
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
|
returned: state is present and on success
|
||||||
type: bool
|
type: bool
|
||||||
|
sample: true
|
||||||
created:
|
created:
|
||||||
description: The date when folder was created
|
description: The date when folder was created.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "2022-10-20T09:31:53Z"
|
||||||
createdBy:
|
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
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "Anonymous"
|
||||||
hasAcl:
|
hasAcl:
|
||||||
description: Boolean value specifying if folder has acl
|
description: Boolean value specifying if folder has acl.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: bool
|
type: bool
|
||||||
|
sample: true
|
||||||
id:
|
id:
|
||||||
description: The ID for the folder
|
description: The ID for the folder.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: int
|
type: int
|
||||||
|
sample: 18
|
||||||
title:
|
title:
|
||||||
description: The name of the folder
|
description: The name of the folder.
|
||||||
returned: on success
|
returned: on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: foldername
|
||||||
uid:
|
uid:
|
||||||
description: The UID for the folder
|
description: The UID for the folder.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: foldername
|
||||||
updated:
|
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
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "2022-10-20T09:31:53Z"
|
||||||
updatedBy:
|
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
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "Anonymous"
|
||||||
url:
|
url:
|
||||||
description: The URl for the folder
|
description: The URl for the folder.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "/dashboards/f/foldername/foldername"
|
||||||
version:
|
version:
|
||||||
description: The version of the folder
|
description: The version of the folder.
|
||||||
returned: state is present and on success
|
returned: state is present and on success
|
||||||
type: int
|
type: int
|
||||||
|
sample: 1
|
||||||
message:
|
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
|
returned: state is absent and on success
|
||||||
type: str
|
type: str
|
||||||
|
sample: "Folder foldername deleted"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
@ -189,6 +206,7 @@ def absent_folder(module):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module_args = dict(
|
module_args = dict(
|
||||||
title=dict(type='str', required=True),
|
title=dict(type='str', required=True),
|
||||||
uid=dict(type='str', required=True),
|
uid=dict(type='str', required=True),
|
||||||
@ -204,10 +222,12 @@ def main():
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=module_args,
|
argument_spec=module_args
|
||||||
supports_check_mode=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not HAS_REQUESTS:
|
||||||
|
module.fail_json("Missing package - `request` ")
|
||||||
|
|
||||||
is_error, has_changed, result = choice_map.get(
|
is_error, has_changed, result = choice_map.get(
|
||||||
module.params['state'])(module)
|
module.params['state'])(module)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user