summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2020-04-07 15:43:40 +0800
committerlijia <[email protected]>2020-04-07 15:43:40 +0800
commitaca4de7ec302ff95ae240ee6a8f199afda984dd4 (patch)
tree64411ff0d5b81dcd4c4ab11ff8c6b3b3c2375132
parentbbf5651c70c27b627038e42c2d511152e8786804 (diff)
uninstall.yml增加删除库表role.oam_20200407
-rw-r--r--roles/oam_env_cleanup/tasks/main.yml12
-rw-r--r--roles/oam_env_cleanup/templates/sql.txt1
-rw-r--r--roles/oam_env_cleanup/templates/tsg_threshold_cleanup.sql.j223
-rw-r--r--uninstall_oam_for_40.170.yml8
4 files changed, 43 insertions, 1 deletions
diff --git a/roles/oam_env_cleanup/tasks/main.yml b/roles/oam_env_cleanup/tasks/main.yml
new file mode 100644
index 0000000..ee8a5d1
--- /dev/null
+++ b/roles/oam_env_cleanup/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+
+- name: "Templates tsg_threshold.sql"
+ template:
+ src: "{{role_path}}/templates/tsg_threshold_cleanup.sql.j2"
+ dest: /tmp/tsg_threshold_cleanup.sql
+ tags: cleanup
+
+
+- name: "import the sql after template"
+ shell: mysql -s -h 127.0.0.1 -u {{ mariadb.username }} -p{{ mariadb.password }} < /tmp/tsg_threshold_cleanup.sql
+ tags: cleanup \ No newline at end of file
diff --git a/roles/oam_env_cleanup/templates/sql.txt b/roles/oam_env_cleanup/templates/sql.txt
new file mode 100644
index 0000000..234f528
--- /dev/null
+++ b/roles/oam_env_cleanup/templates/sql.txt
@@ -0,0 +1 @@
+mysql -s -h $host -u $user -p$passwd $dbname < tsg_threshold.sql \ No newline at end of file
diff --git a/roles/oam_env_cleanup/templates/tsg_threshold_cleanup.sql.j2 b/roles/oam_env_cleanup/templates/tsg_threshold_cleanup.sql.j2
new file mode 100644
index 0000000..c7cd564
--- /dev/null
+++ b/roles/oam_env_cleanup/templates/tsg_threshold_cleanup.sql.j2
@@ -0,0 +1,23 @@
+/*
+Navicat MySQL Data Transfer
+
+Source Server : localhost
+Source Server Version : 50713
+Source Host : localhost:3306
+Source Database : alt
+
+Target Server Type : MYSQL
+Target Server Version : 50713
+File Encoding : 65001
+
+Date: 2020-01-21 17:33:00
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+use tsg_oam;
+
+-- ----------------------------
+-- Table structure for `tsg_threshold`
+-- ----------------------------
+DROP TABLE IF EXISTS `tsg_threshold`; \ No newline at end of file
diff --git a/uninstall_oam_for_40.170.yml b/uninstall_oam_for_40.170.yml
index 8c7b8e9..a437d2a 100644
--- a/uninstall_oam_for_40.170.yml
+++ b/uninstall_oam_for_40.170.yml
@@ -59,4 +59,10 @@
- name: "uninstall oam_cli_agent_mxn"
yum:
name: "oam_cli_agent_mxn"
- state: absent \ No newline at end of file
+ state: absent
+
+- hosts: sled-mcn0
+ gather_facts: no
+ roles:
+ - oam_env_cleanup
+ \ No newline at end of file