uninstall.yml增加删除库表role.
This commit is contained in:
12
roles/oam_env_cleanup/tasks/main.yml
Normal file
12
roles/oam_env_cleanup/tasks/main.yml
Normal file
@@ -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
|
||||
1
roles/oam_env_cleanup/templates/sql.txt
Normal file
1
roles/oam_env_cleanup/templates/sql.txt
Normal file
@@ -0,0 +1 @@
|
||||
mysql -s -h $host -u $user -p$passwd $dbname < tsg_threshold.sql
|
||||
23
roles/oam_env_cleanup/templates/tsg_threshold_cleanup.sql.j2
Normal file
23
roles/oam_env_cleanup/templates/tsg_threshold_cleanup.sql.j2
Normal file
@@ -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`;
|
||||
@@ -59,4 +59,10 @@
|
||||
- name: "uninstall oam_cli_agent_mxn"
|
||||
yum:
|
||||
name: "oam_cli_agent_mxn"
|
||||
state: absent
|
||||
state: absent
|
||||
|
||||
- hosts: sled-mcn0
|
||||
gather_facts: no
|
||||
roles:
|
||||
- oam_env_cleanup
|
||||
|
||||
Reference in New Issue
Block a user