|
4 | 4 | from __future__ import (absolute_import, division, print_function) |
5 | 5 | __metaclass__ = type |
6 | 6 |
|
7 | | -import requests |
8 | | -import json |
9 | | - |
10 | 7 | DOCUMENTATION = r''' |
11 | 8 | --- |
12 | | -module: user_namepace_facts |
| 9 | +module: grafana_elasticsearch_query |
13 | 10 |
|
14 | | -short_description: Returns subgid and subuid maps |
| 11 | +short_description: Get elasticsearch hits via grafana |
15 | 12 |
|
16 | 13 | version_added: "1.0.0" |
17 | 14 |
|
18 | | -description: Returns subgid and subuid maps. |
| 15 | +description: Returns hits from selected datasource and indices. |
19 | 16 |
|
20 | 17 | author: |
21 | | - - Will Szumski (@jovial) |
| 18 | + - Steve Brasier |
22 | 19 | ''' |
23 | 20 |
|
24 | 21 | EXAMPLES = r''' |
25 | | -- name: Return ansible_facts |
26 | | - user_namepace_facts: |
| 22 | +- name: Get elasticsearch hits |
| 23 | + grafana_elasticsearch_query: |
| 24 | + grafana_url: http://{{ grafana_api_address }}:{{ grafana_port }} |
| 25 | + grafana_username: grafana |
| 26 | + grafana_password: "{{ vault_grafana_admin_password }}" |
| 27 | + datasource: slurmstats |
| 28 | + index_pattern: 'filebeat-*' |
27 | 29 | ''' |
28 | 30 |
|
29 | 31 | RETURN = r''' |
30 | 32 | # These are examples of possible return values, and in general should use other names for return values. |
31 | | -ansible_facts: |
32 | | - description: Facts to add to ansible_facts. |
| 33 | +docs: |
| 34 | + description: List of dicts with the original json in each document. |
33 | 35 | returned: always |
34 | | - type: dict |
35 | | - contains: |
36 | | - subuid: |
37 | | - description: Parsed output of /etc/subuid |
38 | | - type: str |
39 | | - returned: always, empty dict if /etc/subuid doesn't exist |
40 | | - sample: { "foo": {"size": 123, "start": 100000 }} |
41 | | - subgid: |
42 | | - description: Parsed output of /etc/subgid |
43 | | - type: str |
44 | | - returned: always, empty dict if /etc/subgid doesn't exist |
45 | | - sample: { "foo": {"size": 123, "start": 100000 }} |
| 36 | + type: list |
46 | 37 | ''' |
47 | 38 |
|
48 | 39 | from ansible.module_utils.basic import AnsibleModule |
49 | | -import csv |
50 | | -import os |
| 40 | +import requests |
| 41 | +import json |
51 | 42 |
|
52 | 43 | def run_module(): |
53 | 44 | module_args = dict( |
|
0 commit comments