feat: add retention policies
This commit is contained in:
parent
0bacd505f0
commit
b19cfba1fa
6 changed files with 35 additions and 2 deletions
|
@ -11,6 +11,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- add retention policies
|
||||||
- add support for debian 11
|
- add support for debian 11
|
||||||
- add support for debian 10 and python3
|
- add support for debian 10 and python3
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,15 @@ Install and configure InfluxDB
|
||||||
state: present
|
state: present
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `influxdb_retention_policies` - array with the retention policies
|
||||||
|
|
||||||
|
```
|
||||||
|
- name: default
|
||||||
|
database: test_db
|
||||||
|
duration: 1d
|
||||||
|
default: true
|
||||||
|
```
|
||||||
|
|
||||||
* `influxdb_api_user` - set the api user if you have enabled http authentification (default: `admin`)
|
* `influxdb_api_user` - set the api user if you have enabled http authentification (default: `admin`)
|
||||||
* `influxdb_api_password` - set the api password if you have enabled http authentification
|
* `influxdb_api_password` - set the api password if you have enabled http authentification
|
||||||
* `influxdb_api_port` - set the api port (default: `8086`)
|
* `influxdb_api_port` - set the api port (default: `8086`)
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
---
|
---
|
||||||
influxdb_databases: []
|
|
||||||
influxdb_users: []
|
|
||||||
influxdb_api_user: admin
|
influxdb_api_user: admin
|
||||||
influxdb_api_port: 8086
|
influxdb_api_port: 8086
|
||||||
influxdb_default_config:
|
influxdb_default_config:
|
||||||
|
@ -11,3 +9,6 @@ influxdb_default_config:
|
||||||
wal-dir: /var/lib/influxdb/wal
|
wal-dir: /var/lib/influxdb/wal
|
||||||
influxdb_config: {}
|
influxdb_config: {}
|
||||||
influxdb_full_config: '{{ influxdb_default_config|combine(influxdb_config) }}'
|
influxdb_full_config: '{{ influxdb_default_config|combine(influxdb_config) }}'
|
||||||
|
influxdb_databases: []
|
||||||
|
influxdb_policies: []
|
||||||
|
influxdb_users: []
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
state: absent
|
state: absent
|
||||||
influxdb_databases:
|
influxdb_databases:
|
||||||
- test_db
|
- test_db
|
||||||
|
influxdb_retention_policies:
|
||||||
|
- name: default
|
||||||
|
database: test_db
|
||||||
|
duration: 1d
|
||||||
|
default: true
|
||||||
influxdb_config:
|
influxdb_config:
|
||||||
'[collectd]':
|
'[collectd]':
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
@ -37,6 +37,11 @@ def test_databases(host):
|
||||||
assert cmd.succeeded
|
assert cmd.succeeded
|
||||||
assert 'test_db' in cmd.stdout
|
assert 'test_db' in cmd.stdout
|
||||||
|
|
||||||
|
def test_databases(host):
|
||||||
|
cmd = host.run('influx -execute "SHOW RETENTION POLICIES ON test_db"')
|
||||||
|
assert cmd.succeeded
|
||||||
|
assert re.search(r'default\s+24h0m0s\s+1h0m0s\s+1\s+true', cmd.stdout)
|
||||||
|
|
||||||
def test_grants(host):
|
def test_grants(host):
|
||||||
cmd = host.run('influx -execute "SHOW GRANTS FOR test"')
|
cmd = host.run('influx -execute "SHOW GRANTS FOR test"')
|
||||||
assert cmd.succeeded
|
assert cmd.succeeded
|
||||||
|
|
|
@ -30,6 +30,18 @@
|
||||||
loop: '{{ influxdb_databases }}'
|
loop: '{{ influxdb_databases }}'
|
||||||
tags: influxdb
|
tags: influxdb
|
||||||
|
|
||||||
|
- name: create retention policies
|
||||||
|
community.general.influxdb_retention_policy:
|
||||||
|
policy_name: '{{ item.name }}'
|
||||||
|
database_name: '{{ item.database }}'
|
||||||
|
duration: '{{ item.duration }}'
|
||||||
|
replication: '{{ item.replication|default(1) }}'
|
||||||
|
default: '{{ item.default|default(False) }}'
|
||||||
|
username: '{{ influxdb_api_user }}'
|
||||||
|
password: '{{ influxdb_api_password }}'
|
||||||
|
loop: '{{ influxdb_retention_policies }}'
|
||||||
|
tags: influxdb
|
||||||
|
|
||||||
- name: create users
|
- name: create users
|
||||||
community.general.influxdb_user:
|
community.general.influxdb_user:
|
||||||
user_name: '{{ item.name }}'
|
user_name: '{{ item.name }}'
|
||||||
|
|
Loading…
Reference in a new issue