From 5aba47de31c319001561f79fd2e130f864f5ed65 Mon Sep 17 00:00:00 2001 From: zhangzhihan Date: Fri, 25 Sep 2020 15:10:14 +0800 Subject: [PATCH] update --- .../backup_framework_config/tasks/main.yml | 9 +++- .../roles/backup_marsio_config/tasks/main.yml | 9 +++- .../roles/backup_sapp_config/tasks/main.yml | 45 ++++++++++++++++--- .../roles/backup_tfe_config/tasks/main.yml | 17 ++++--- .../roles/backup_tsgenv_config/tasks/main.yml | 9 +++- uninstall/roles/firewall/tasks/main.yml | 12 +++++ uninstall/roles/framework/tasks/main.yml | 14 ++++++ uninstall/roles/remove_files/tasks/main.yml | 30 ++++++++----- .../group_vars/uninstall_vars.yml | 4 +- uninstall/uninstall_config/hosts | 2 +- 10 files changed, 120 insertions(+), 31 deletions(-) diff --git a/uninstall/roles/backup_framework_config/tasks/main.yml b/uninstall/roles/backup_framework_config/tasks/main.yml index c2d0aae..9bc9482 100644 --- a/uninstall/roles/backup_framework_config/tasks/main.yml +++ b/uninstall/roles/backup_framework_config/tasks/main.yml @@ -4,11 +4,18 @@ state: directory ignore_errors: true +- name: "optMESA_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/optMESA_{{ uninstall_version }}_{{ date }}.zip" + register: optMESA_directory + ignore_errors: true + - name: "backup /opt/MESA to destination path" archive: path: /opt/MESA dest: "{{ backup_dest_path }}/optMESA_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.framework == 1 + when: + - optMESA_directory.rc != 0 + - backup.framework == 1 ignore_errors: true diff --git a/uninstall/roles/backup_marsio_config/tasks/main.yml b/uninstall/roles/backup_marsio_config/tasks/main.yml index fb69093..99804d8 100644 --- a/uninstall/roles/backup_marsio_config/tasks/main.yml +++ b/uninstall/roles/backup_marsio_config/tasks/main.yml @@ -4,10 +4,17 @@ state: directory ignore_errors: true +- name: "mrzcpd_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/mrzcpd_{{ uninstall_version }}_{{ date }}.zip" + register: mrzcpd_directory + ignore_errors: true + - name: "backup /opt/mrzcpd to destination path" archive: path: /opt/mrzcpd dest: "{{ backup_dest_path }}/mrzcpd_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.marsio == 1 + when: + - mrzcpd_directory.rc != 0 + - backup.marsio == 1 ignore_errors: true diff --git a/uninstall/roles/backup_sapp_config/tasks/main.yml b/uninstall/roles/backup_sapp_config/tasks/main.yml index 03cf82d..b799c4f 100644 --- a/uninstall/roles/backup_sapp_config/tasks/main.yml +++ b/uninstall/roles/backup_sapp_config/tasks/main.yml @@ -4,12 +4,39 @@ state: directory ignore_errors: true +- name: "sapp_etc_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/sapp_etc_{{ uninstall_version }}_{{ date }}.zip" + register: sapp_etc + ignore_errors: true + +- name: "sapp_plug_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/sapp_plug_{{ uninstall_version }}_{{ date }}.zip" + register: sapp_plug + ignore_errors: true + +- name: "sapp_tsgconf_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/sapp_tsgconf_{{ uninstall_version }}_{{ date }}.zip" + register: sapp_tsgconf + ignore_errors: true + +- name: "sapp_appconf_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/sapp_appconf_{{ uninstall_version }}_{{ date }}.zip" + register: sapp_appconf + ignore_errors: true + +- name: "sapp_conf_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/sapp_conf_{{ uninstall_version }}_{{ date }}.zip" + register: sapp_conf + ignore_errors: true + - name: "backup sapp_run/etc to destination path" archive: path: /home/mesasoft/sapp_run/etc dest: "{{ backup_dest_path }}/sapp_etc_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.sapp_etc == 1 + when: + - sapp_etc.rc != 0 + - backup.sapp_etc == 1 ignore_errors: true - name: "backup sapp_run/plug to destination path" @@ -17,7 +44,9 @@ path: /home/mesasoft/sapp_run/plug dest: "{{ backup_dest_path }}/sapp_plug_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.sapp_plug == 1 + when: + - sapp_plug.rc != 0 + - backup.sapp_plug == 1 ignore_errors: true - name: "backup sapp_run/tsgconf/ to destination path" @@ -25,7 +54,9 @@ path: /home/mesasoft/sapp_run/tsgconf dest: "{{ backup_dest_path }}/sapp_tsgconf_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.sapp_tsgconf == 1 + when: + - sapp_tsgconf.rc != 0 + - backup.sapp_tsgconf == 1 ignore_errors: true - name: "backup sapp_run/appconf/ to destination path" @@ -33,7 +64,9 @@ path: /home/mesasoft/sapp_run/appconf dest: "{{ backup_dest_path }}/sapp_appconf_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.sapp_appconf == 1 + when: + - sapp_appconf.rc != 0 + - backup.sapp_appconf == 1 ignore_errors: true - name: "backup sapp_run/conf/ to destination path" @@ -41,7 +74,9 @@ path: /home/mesasoft/sapp_run/conf dest: "{{ backup_dest_path }}/sapp_conf_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.sapp_conf == 1 + when: + - sapp_conf.rc != 0 + - backup.sapp_conf == 1 ignore_errors: true diff --git a/uninstall/roles/backup_tfe_config/tasks/main.yml b/uninstall/roles/backup_tfe_config/tasks/main.yml index 2b528cf..4774ae5 100644 --- a/uninstall/roles/backup_tfe_config/tasks/main.yml +++ b/uninstall/roles/backup_tfe_config/tasks/main.yml @@ -4,18 +4,17 @@ state: directory ignore_errors: true +- name: "tfe_conf_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/tfe_conf_{{ uninstall_version }}_{{ date }}.zip" + register: tfeconf_directory + ignore_errors: true + - name: "backup /opt/tsg/tfe/conf to destination path" archive: path: /opt/tsg/tfe/conf dest: "{{ backup_dest_path }}/tfe_conf_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.tfe == 1 + when: + - tfeconf_directory.rc != 0 + - backup.tfe == 1 ignore_errors: true - -- name: "backup /opt/tsg/env to destination path" - archive: - path: /opt/tsg/env - dest: "{{ backup_dest_path }}/tsg_env_1_{{ uninstall_version }}_{{ date }}.zip" - format: zip - when: backup.tsg_env == 1 - ignore_errors: true diff --git a/uninstall/roles/backup_tsgenv_config/tasks/main.yml b/uninstall/roles/backup_tsgenv_config/tasks/main.yml index 7c677ce..40c61ac 100644 --- a/uninstall/roles/backup_tsgenv_config/tasks/main.yml +++ b/uninstall/roles/backup_tsgenv_config/tasks/main.yml @@ -4,10 +4,17 @@ state: directory ignore_errors: true +- name: "tsg_env_{{ uninstall_version }}_{{ date }}.zip exist?" + shell: "ls {{ backup_dest_path }}/tsg_env_{{ uninstall_version }}_{{ date }}.zip" + register: tsgenv_directory + ignore_errors: true + - name: "backup /opt/tsg/env to destination path" archive: path: /opt/tsg/env dest: "{{ backup_dest_path }}/tsg_env_{{ uninstall_version }}_{{ date }}.zip" format: zip - when: backup.tsg_env == 1 + when: + - tsgenv_directory.rc != 0 + - backup.tsg_env == 1 ignore_errors: true diff --git a/uninstall/roles/firewall/tasks/main.yml b/uninstall/roles/firewall/tasks/main.yml index 8cccb5b..f8e9968 100644 --- a/uninstall/roles/firewall/tasks/main.yml +++ b/uninstall/roles/firewall/tasks/main.yml @@ -9,6 +9,18 @@ - uninstall.firewall == 1 ignore_errors: true +- name: "[uninstall firewall] create /home/mesasoft/sapp_runetc/" + file: + path: /home/mesasoft/sapp_runetc/ + state: directory + when: uninstall.firewall == 1 + +- name: "[uninstall firewall] create entrylist.conf" + file: + path: /home/mesasoft/sapp_runetc/entrylist.conf + state: touch + when: uninstall.firewall == 1 + - name: "[uninstall firewall] uninstall firewall" yum: name: diff --git a/uninstall/roles/framework/tasks/main.yml b/uninstall/roles/framework/tasks/main.yml index a17206d..8604367 100644 --- a/uninstall/roles/framework/tasks/main.yml +++ b/uninstall/roles/framework/tasks/main.yml @@ -1,3 +1,17 @@ +- name: "[uninstall framework] create project_list.conf" + file: + path: /home/mesasoft/sapp_run/etc/project_list.conf + state: touch + when: uninstall.framework == 1 + ignore_errors: true + +- name: "[uninstall framework] create conflist.inf" + file: + path: /home/mesasoft/sapp_run/plug/conflist.inf + state: touch + when: uninstall.framework == 1 + ignore_errors: true + - name: "[uninstall framework] uninstall framework" yum: name: diff --git a/uninstall/roles/remove_files/tasks/main.yml b/uninstall/roles/remove_files/tasks/main.yml index 96caa5c..a29f227 100644 --- a/uninstall/roles/remove_files/tasks/main.yml +++ b/uninstall/roles/remove_files/tasks/main.yml @@ -47,14 +47,17 @@ when: remove.telegraf_statistic == 1 ignore_errors: true -- name: "remove certstore files" +- name: "remove /home/tsg/certstore files" file: - path: "{{ certstore_path }}" + path: /home/tsg/certstore + state: absent + when: remove.certstore == 1 + ignore_errors: true + +- name: "remove /opt/tsg/certstore files" + file: + path: /opt/tsg/certstore state: absent - vars: - certstore_path: - - /home/tsg/certstore - - /opt/tsg/certstore when: remove.certstore == 1 ignore_errors: true @@ -65,14 +68,17 @@ when: remove.certstore == 1 ignore_errors: true -- name: "remove cert-redis files" +- name: "remove /opt/tsg/cert-redis files" file: - path: "{{ certredis_path }}" + path: /opt/tsg/cert-redis + state: absent + when: remove.certredis == 1 + ignore_errors: true + +- name: "remove /home/tsg/cert-redis files" + file: + path: /home/tsg/cert-redis state: absent - vars: - certredis_path: - - /home/tsg/certstore - - /opt/tsg/certstore when: remove.certredis == 1 ignore_errors: true diff --git a/uninstall/uninstall_config/group_vars/uninstall_vars.yml b/uninstall/uninstall_config/group_vars/uninstall_vars.yml index b6a94ae..c2e5f68 100644 --- a/uninstall/uninstall_config/group_vars/uninstall_vars.yml +++ b/uninstall/uninstall_config/group_vars/uninstall_vars.yml @@ -6,7 +6,7 @@ uninstall_version: 20.09 #################### #Backup backup_dest_path: /root/backup_data -date: 20200921 +date: 20200925 backup: tsg_env: 1 marsio: 1 @@ -45,6 +45,8 @@ remove: sapp: 1 tfe: 1 clotho: 1 + certstore: 1 + certredis: 1 http_healthcheck: 1 telegraf_statistic: 1 diff --git a/uninstall/uninstall_config/hosts b/uninstall/uninstall_config/hosts index 52d53e0..5711a53 100644 --- a/uninstall/uninstall_config/hosts +++ b/uninstall/uninstall_config/hosts @@ -13,6 +13,6 @@ #10.3.74.1 #10.3.75.1 [uninstall_server] -172.16.124.134 +192.168.40.225 [uninstall_adc_mcn0] [uninstall_adc_mcn123]