summaryrefslogtreecommitdiff
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
parent39a13763eb34433f68c04122c2cf8eb9f70aa268 (diff)
更新influxdb安装模块
-rw-r--r--deploy.yml_bak70
-rw-r--r--roles/influxdb/tasks/main.yml14
-rw-r--r--roles/influxdb/templates/influxdb.conf.j22
-rw-r--r--test_host/group_vars/blade-00.yml3
-rw-r--r--test_host/group_vars/cluster_server.yml4
-rw-r--r--test_host/hosts2
6 files changed, 10 insertions, 85 deletions
diff --git a/deploy.yml_bak b/deploy.yml_bak
deleted file mode 100644
index 8b0e3b9..0000000
--- a/deploy.yml_bak
+++ /dev/null
@@ -1,70 +0,0 @@
-- hosts: cluster_server
- roles:
- - consul-cluster
- - mariadb
- - influxdb
-
-- hosts: blade-mxn
- roles:
- - jdk1.8.0_73
- - consul-external
-
-- hosts: blade-00
- roles:
- - jdk1.8.0_73
- - mariadb
- - consul-internal
- - telegraf
- - influxdb
- - grafana
-
-- hosts: blade-01
- roles:
- - jdk1.8.0_73
- - consul-internal
-
-- hosts: blade-02
- roles:
- - jdk1.8.0_73
- - consul-internal
-
-- hosts: blade-03
- roles:
- - jdk1.8.0_73
- - consul-internal
-
-- hosts: sled-mxn
- roles:
- - tsg-cli-mxn
- - oam_cli_agent_mxn
- - oam_cli
- - oam_core
- - oam_snmp
-
-- hosts: sled-mcn0
- roles:
- - tsg-cli-mcn0
- - oam_cli_agent
-
-- hosts: sled-mcn1
- roles:
- - tsg-cli-mcn1
- - oam_cli_agent
-
-- hosts: sled-mcn2
- roles:
- - tsg-cli-mcn2
- - oam_cli_agent
-
-- hosts: sled-mcn3
- roles:
- - tsg-cli-mcn3
- - oam_cli_agent
-
-- hosts: sled-mxn
- roles:
- - oam_core_start
-
-- hosts: cluster_server
- roles:
- - oam_cluster
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"
diff --git a/test_host/group_vars/blade-00.yml b/test_host/group_vars/blade-00.yml
deleted file mode 100644
index b4e5300..0000000
--- a/test_host/group_vars/blade-00.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-influxdb:
- cluster_agent: "no"
- mcn0_agent: "yes"
diff --git a/test_host/group_vars/cluster_server.yml b/test_host/group_vars/cluster_server.yml
deleted file mode 100644
index d65b687..0000000
--- a/test_host/group_vars/cluster_server.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-influxdb:
- cluster_agent: "yes"
- mcn0_agent: "no"
-
diff --git a/test_host/hosts b/test_host/hosts
index a65cf5e..c68ac34 100644
--- a/test_host/hosts
+++ b/test_host/hosts
@@ -4,7 +4,7 @@ use_chassis_hardware_sn=false
rpm_file_name=tsg-cli-1.0.14.eccfd07-1.el7.x86_64.rpm
[cluster_server]
-192.168.40.210
+192.168.40.210 influxdb_cluster=true
[blade-mxn]
192.168.40.170 SN=CBT2201925000003 mcn0_ip=192.168.40.166