New in version 2.1.
| parameter | required | default | choices | comments |
|---|---|---|---|---|
| database_name | yes | Name of the database where retention policy will be created | ||
| default | yes | Sets the retention policy as default retention policy | ||
| duration | yes | Determines how long InfluxDB should keep the data | ||
| hostname | yes | The hostname or IP address on which InfluxDB server is listening | ||
| password | no | root | Password that will be used to authenticate against InfluxDB server | |
| policy_name | yes | Name of the retention policy | ||
| port | no | 8086 | The port on which InfluxDB server is listening | |
| replication | yes | Determines how many independent copies of each point are stored in the cluster | ||
| username | no | root | Username that will be used to authenticate against InfluxDB server |
# Example influxdb_retention_policy command from Ansible Playbooks
- name: create 1 hour retention policy
influxdb_retention_policy:
hostname: "{{influxdb_ip_address}}"
database_name: "{{influxdb_database_name}}"
policy_name: test
duration: 1h
replication: 1
- name: create 1 day retention policy
influxdb_retention_policy:
hostname: "{{influxdb_ip_address}}"
database_name: "{{influxdb_database_name}}"
policy_name: test
duration: 1d
replication: 1
- name: create 1 week retention policy
influxdb_retention_policy:
hostname: "{{influxdb_ip_address}}"
database_name: "{{influxdb_database_name}}"
policy_name: test
duration: 1w
replication: 1
- name: create infinite retention policy
influxdb_retention_policy:
hostname: "{{influxdb_ip_address}}"
database_name: "{{influxdb_database_name}}"
policy_name: test
duration: INF
replication: 1
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/influxdb_retention_policy_module.html