- name: "copy influxdb.rpm to destination server"
copy:
src: "{{ role_path }}/files/"
dest: /tmp
- name: "install influxdb"
yum:
name:
- /tmp/influxdb-1.7.7.x86_64.rpm
state: present
- name: "Templates influxdb.conf"
template:
src: "{{role_path}}/templates/influxdb.conf.j2"
dest: /etc/influxdb/influxdb.conf
tags: template
- name: "Start influxdb"
systemd:
name: influxdb.service
state: restarted
enabled: yes
- name: "create database"
shell: influx -host '127.0.0.1' -port '58086' -execute 'create database tsg_stat;'
- name: "create user"
shell: influx -host '127.0.0.1' -port '58086' -database 'tsg_stat' -execute "create user "admin" with password 'tsg2019' with all privileges"
- name: "set cluster influxdb retention policy"
shell: influx -port 58086 -execute 'CREATE RETENTION POLICY "1_year" ON "tsg_stat" DURATION 365d REPLICATION 1 DEFAULT'
- name: "set mcn0 influxdb retention policy"
shell: influx -port 58086 -execute 'CREATE RETENTION POLICY "1_day" ON "tsg_stat" DURATION 1d REPLICATION 1 DEFAULT'