summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorzhangzhihan <[email protected]>2020-04-14 16:36:39 +0800
committerzhangzhihan <[email protected]>2020-04-14 16:36:39 +0800
commitf8bd266c3c4df4032e2a9fa6e4769fe48d55248d (patch)
tree4193e2426110c5bcbbcf3a4455b91a579ed597b7 /roles
parent39a13763eb34433f68c04122c2cf8eb9f70aa268 (diff)
更新influxdb安装模块
Diffstat (limited to 'roles')
-rw-r--r--roles/influxdb/tasks/main.yml14
-rw-r--r--roles/influxdb/templates/influxdb.conf.j22
2 files changed, 9 insertions, 7 deletions
diff --git a/roles/influxdb/tasks/main.yml b/roles/influxdb/tasks/main.yml
index 4db29e6..783909d 100644
--- a/roles/influxdb/tasks/main.yml
+++ b/roles/influxdb/tasks/main.yml
@@ -21,15 +21,17 @@
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"
+ 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 -port 58086 -execute 'CREATE RETENTION POLICY "1_year" ON "tsg_stat" DURATION 365d REPLICATION 1 DEFAULT'
+ 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 -port 58086 -execute 'CREATE RETENTION POLICY "1_day" ON "tsg_stat" DURATION 1d REPLICATION 1 DEFAULT'
+ 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
diff --git a/roles/influxdb/templates/influxdb.conf.j2 b/roles/influxdb/templates/influxdb.conf.j2
index c6365ad..f375f6a 100644
--- a/roles/influxdb/templates/influxdb.conf.j2
+++ b/roles/influxdb/templates/influxdb.conf.j2
@@ -255,7 +255,7 @@
# The bind address used by the HTTP service.
bind-address = ":58086"
# Determines whether user authentication is enabled over HTTP/HTTPS.
- # auth-enabled = false
+ auth-enabled = true
# The default realm sent back when issuing a basic auth challenge.
# realm = "InfluxDB"