38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
- 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 user"
|
|
shell: influx -host '127.0.0.1' -port '58086' -database '{{ influxdb.dbname }}' -execute "create user "{{ influxdb.username }}" with password '{{ influxdb.passwd }}' with all privileges"
|
|
|
|
- name: "create database"
|
|
shell: influx -host '127.0.0.1' -port '58086' -username '{{ influxdb.username }}' -password '{{ influxdb.passwd }}' -execute 'create database {{ influxdb.dbname }};'
|
|
|
|
- name: "set cluster influxdb retention policy"
|
|
shell: influx -host '127.0.0.1' -port '58086' -username '{{ influxdb.username }}' -password '{{ influxdb.passwd }}' -execute 'CREATE RETENTION POLICY "1_year" ON "tsg_stat" DURATION 365d REPLICATION 1 DEFAULT'
|
|
when: influxdb_cluster is defined
|
|
|
|
- name: "set mcn0 influxdb retention policy"
|
|
shell: influx -host '127.0.0.1' -port '58086' -username '{{ influxdb.username }}' -password '{{ influxdb.passwd }}' -execute 'CREATE RETENTION POLICY "1_day" ON "tsg_stat" DURATION 1d REPLICATION 1 DEFAULT'
|
|
when: influxdb_cluster is not defined
|
|
|