W3cubDocs

/Ansible

influxdb_retention_policy - Manage InfluxDB retention policies

New in version 2.1.

Synopsis

Manage InfluxDB retention policies

Requirements (on host that executes module)

  • python >= 2.6
  • influxdb >= 0.9

Options

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

Examples

# 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 is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/influxdb_retention_policy_module.html