community / community.general / 2.5.9 / module / influxdb_query Query data points from InfluxDB Authors: René Moser (@resmo)community.general.influxdb_query (2.5.9) — module
Install with ansible-galaxy collection install community.general:==2.5.9
collections: - name: community.general version: 2.5.9
Query data points from InfluxDB.
- name: Query connections community.general.influxdb_query: hostname: "{{ influxdb_ip_address }}" database_name: "{{ influxdb_database_name }}" query: "select mean(value) from connections" register: connection
- name: Query connections with tags filters community.general.influxdb_query: hostname: "{{ influxdb_ip_address }}" database_name: "{{ influxdb_database_name }}" query: "select mean(value) from connections where region='zue01' and host='server01'" register: connection
- name: Print results from the query ansible.builtin.debug: var: connection.query_results
ssl: default: false description: - Use https instead of http to connect to InfluxDB server. type: bool path: description: - The path on which InfluxDB server is accessible - Only available when using python-influxdb >= 5.1.0 type: str version_added: 0.2.0 version_added_collection: community.general port: default: 8086 description: - The port on which InfluxDB server is listening type: int query: description: - Query to be executed. required: true type: str proxies: description: - HTTP(S) proxy to use for Requests to connect to InfluxDB server. type: dict retries: default: 3 description: - Number of retries client will try before aborting. - C(0) indicates try until success. - Only available when using python-influxdb >= 4.1.0 type: int timeout: description: - Number of seconds Requests will wait for client to establish a connection. type: int use_udp: default: false description: - Use UDP to connect to InfluxDB server. type: bool hostname: default: localhost description: - The hostname or IP address on which InfluxDB server is listening. - Since Ansible 2.5, defaulted to localhost. type: str password: aliases: - login_password default: root description: - Password that will be used to authenticate against InfluxDB server. - Alias C(login_password) added in Ansible 2.5. type: str udp_port: default: 4444 description: - UDP port to connect to InfluxDB server. type: int username: aliases: - login_username default: root description: - Username that will be used to authenticate against InfluxDB server. - Alias C(login_username) added in Ansible 2.5. type: str database_name: description: - Name of the database. required: true type: str validate_certs: default: true description: - If set to C(no), the SSL certificates will not be validated. - This should only set to C(no) used on personally controlled sites using self-signed certificates. type: bool
query_results: description: Result from the query returned: success sample: - mean: 1245.5333333333333 time: '1970-01-01T00:00:00Z' type: list