diff options
Diffstat (limited to 'tasks')
27 files changed, 350 insertions, 0 deletions
diff --git a/tasks/diabled_tsg-monitor.yml b/tasks/diabled_tsg-monitor.yml new file mode 100644 index 0000000..538063f --- /dev/null +++ b/tasks/diabled_tsg-monitor.yml @@ -0,0 +1,13 @@ +- hosts: + - adc_mcn0 + - adc_mcn1 + - adc_mcn2 + - adc_mcn3 + remote_user: root + tasks: + - name: 'Tsg-monitor service start' + systemd: + name: tsg-monitor + enabled: no + state: stopped + daemon_reload: yes diff --git a/tasks/option-tsg-diagnose/start_tsg_diagnose.yml b/tasks/option-tsg-diagnose/start_tsg_diagnose.yml new file mode 100644 index 0000000..791e97b --- /dev/null +++ b/tasks/option-tsg-diagnose/start_tsg_diagnose.yml @@ -0,0 +1,8 @@ +- hosts: adc_mcn0
+ remote_user: root
+ tasks:
+ - name: 'mcn0 start tsg-diagnose service'
+ systemd:
+ name: tsg-diagnose
+ state: started
+ enabled: yes
diff --git a/tasks/option-tsg-diagnose/stop_tsg_diagnose.yml b/tasks/option-tsg-diagnose/stop_tsg_diagnose.yml new file mode 100644 index 0000000..c2fa938 --- /dev/null +++ b/tasks/option-tsg-diagnose/stop_tsg_diagnose.yml @@ -0,0 +1,8 @@ +- hosts: adc_mcn0
+ remote_user: root
+ tasks:
+ - name: 'mcn0 stop tsg-diagnose service'
+ systemd:
+ name: tsg-diagnose
+ state: stopped
+ enabled: no
diff --git a/tasks/reboot/reboot_adc.yml b/tasks/reboot/reboot_adc.yml new file mode 100644 index 0000000..db38bac --- /dev/null +++ b/tasks/reboot/reboot_adc.yml @@ -0,0 +1,9 @@ +- hosts: + - adc_mcn0 + - adc_mcn1 + - adc_mcn2 + - adc_mcn3 + remote_user: root + tasks: + - name: "reboot" + reboot: diff --git a/tasks/reboot/reboot_adc_mcn_by_ipmitool.yml b/tasks/reboot/reboot_adc_mcn_by_ipmitool.yml new file mode 100644 index 0000000..040a85e --- /dev/null +++ b/tasks/reboot/reboot_adc_mcn_by_ipmitool.yml @@ -0,0 +1,11 @@ +- hosts: adc_mxn + remote_user: root + tasks: + - name: "reboot adc in mxn by ipmitool" + shell: "{{ item }}" + ignore_errors: true + with_items: + - ipmitool -t 0x90 chassis power reset + - ipmitool -t 0x80 chassis power reset + - ipmitool -t 0x98 chassis power reset + - ipmitool -t 0x88 chassis power reset diff --git a/tasks/reboot/reboot_adc_mcn_by_ssh.yml b/tasks/reboot/reboot_adc_mcn_by_ssh.yml new file mode 100644 index 0000000..d901da3 --- /dev/null +++ b/tasks/reboot/reboot_adc_mcn_by_ssh.yml @@ -0,0 +1,13 @@ +- hosts: adc_mxn + remote_user: root + tasks: + - name: "reboot adc mcn*" + shell: "{{ item }}" + ignore_errors: true + with_items: + - ssh 192.168.100.1 reboot + - ssh 192.168.100.2 reboot + - ssh 192.168.100.3 reboot + - ssh 192.168.100.4 reboot + - reboot + diff --git a/tasks/remove_mrzcpd_system_edit.yml b/tasks/remove_mrzcpd_system_edit.yml new file mode 100644 index 0000000..77cbb92 --- /dev/null +++ b/tasks/remove_mrzcpd_system_edit.yml @@ -0,0 +1,9 @@ +- hosts:
+ - adc_mcn0
+ - adc_mcn1
+ - adc_mcn2
+ - adc_mcn3
+ remote_user: root
+ tasks:
+ - name: 'remove mrzcpd system edit memory config'
+ shell: rm /etc/systemd/system/mrzcpd.service.d/memory.conf
diff --git a/tasks/reset_maat_redis.yml b/tasks/reset_maat_redis.yml new file mode 100644 index 0000000..90ef462 --- /dev/null +++ b/tasks/reset_maat_redis.yml @@ -0,0 +1,5 @@ +- hosts: adc_mcn3 + remote_user: root + tasks: + - name: 'reset maat-redis' + shell: systemctl daemon-reload; systemctl reset-failed maat-redis diff --git a/tasks/restart_process/restart_adc-exporter-systemd.yml b/tasks/restart_process/restart_adc-exporter-systemd.yml new file mode 100644 index 0000000..625abba --- /dev/null +++ b/tasks/restart_process/restart_adc-exporter-systemd.yml @@ -0,0 +1,15 @@ +- hosts:
+ - adc_mxn
+ - adc_mcn0
+ - adc_mcn1
+ - adc_mcn2
+ - adc_mcn3
+ remote_user: root
+ tasks:
+ - name: 'adc-exporter-systemd service start'
+ systemd:
+ name: adc-exporter-systemd
+ enabled: yes
+ daemon_reload: yes
+ state: restarted
+
diff --git a/tasks/restart_process/restart_certstore.yml b/tasks/restart_process/restart_certstore.yml new file mode 100644 index 0000000..ddb1baf --- /dev/null +++ b/tasks/restart_process/restart_certstore.yml @@ -0,0 +1,11 @@ +- hosts:
+ - adc_mcn0
+ remote_user: root
+ tasks:
+ - name: 'certstore service start'
+ systemd:
+ name: certstore
+ enabled: yes
+ daemon_reload: yes
+ state: restarted
+
diff --git a/tasks/restart_process/restart_mrzcpd.yml b/tasks/restart_process/restart_mrzcpd.yml new file mode 100644 index 0000000..39e12ed --- /dev/null +++ b/tasks/restart_process/restart_mrzcpd.yml @@ -0,0 +1,14 @@ +- hosts:
+ - adc_mcn0
+ - adc_mcn1
+ - adc_mcn2
+ - adc_mcn3
+ remote_user: root
+ tasks:
+ - name: 'mrzcpd service start'
+ systemd:
+ name: mrzcpd
+ enabled: yes
+ daemon_reload: yes
+ state: restarted
+
diff --git a/tasks/restart_process/restart_process.yml b/tasks/restart_process/restart_process.yml new file mode 100644 index 0000000..4df97bd --- /dev/null +++ b/tasks/restart_process/restart_process.yml @@ -0,0 +1,7 @@ +--- +- include: restart_telegraf_statistic.yml +- include: restart_mrzcpd.yml +- include: restart_sapp.yml +- include: restart_certstore.yml +- include: restart_tfe.yml +- include: restart_adc-exporter-systemd.yml diff --git a/tasks/restart_process/restart_sapp.yml b/tasks/restart_process/restart_sapp.yml new file mode 100644 index 0000000..71775fd --- /dev/null +++ b/tasks/restart_process/restart_sapp.yml @@ -0,0 +1,11 @@ +- hosts:
+ - adc_mcn0
+ remote_user: root
+ tasks:
+ - name: 'sapp service start'
+ systemd:
+ name: sapp
+ enabled: yes
+ daemon_reload: yes
+ state: restarted
+
diff --git a/tasks/restart_process/restart_sapp_tfe_certstore.yml b/tasks/restart_process/restart_sapp_tfe_certstore.yml new file mode 100644 index 0000000..dd10ef2 --- /dev/null +++ b/tasks/restart_process/restart_sapp_tfe_certstore.yml @@ -0,0 +1,4 @@ +--- +- include: restart_sapp.yml +- include: restart_certstore.yml +- include: restart_tfe.yml diff --git a/tasks/restart_process/restart_telegraf_statistic.yml b/tasks/restart_process/restart_telegraf_statistic.yml new file mode 100644 index 0000000..da182db --- /dev/null +++ b/tasks/restart_process/restart_telegraf_statistic.yml @@ -0,0 +1,11 @@ +- hosts:
+ - adc_mcn0
+ remote_user: root
+ tasks:
+ - name: 'telegraf_statistic service start'
+ systemd:
+ name: telegraf_statistic
+ enabled: yes
+ daemon_reload: yes
+ state: restarted
+
diff --git a/tasks/restart_process/restart_tfe.yml b/tasks/restart_process/restart_tfe.yml new file mode 100644 index 0000000..2754d8f --- /dev/null +++ b/tasks/restart_process/restart_tfe.yml @@ -0,0 +1,13 @@ +- hosts:
+ - adc_mcn1
+ - adc_mcn2
+ - adc_mcn3
+ remote_user: root
+ tasks:
+ - name: 'tfe service start'
+ systemd:
+ name: tfe
+ enabled: yes
+ daemon_reload: yes
+ state: restarted
+
diff --git a/tasks/stop_telegraf_collect.yml b/tasks/stop_telegraf_collect.yml new file mode 100644 index 0000000..3c3f2b4 --- /dev/null +++ b/tasks/stop_telegraf_collect.yml @@ -0,0 +1,15 @@ +- hosts:
+ - adc_mcn0
+ - adc_mcn1
+ - adc_mcn2
+ - adc_mcn3
+ remote_user: root
+ tasks:
+ - name: 'mcn* stop telegraf_collect service'
+ systemd:
+ name: telegraf_collect
+ state: stopped
+ enabled: no
+
+ - name: 'telegraf_collect config file and service file'
+ shell: rm /etc/telegraf/telegraf_collect.conf; rm /usr/lib/systemd/system/telegraf_collect.service; systemctl daemon-reload
diff --git a/tasks/uninstall/uninstall_maat_redis.yml b/tasks/uninstall/uninstall_maat_redis.yml new file mode 100644 index 0000000..378f031 --- /dev/null +++ b/tasks/uninstall/uninstall_maat_redis.yml @@ -0,0 +1,24 @@ +- hosts: host_uninstall_redis
+ remote_user: root
+ tasks:
+ - name: "maat-redis-uninstall: stop maat-redis service"
+ systemd:
+ name: "{{ item }}"
+ state: stopped
+ with_items:
+ - maat-redis.service
+ - redis.service
+
+ - name: "maat-redis-uninstall: rm maat-redis.conf and maat-redis.service"
+ file:
+ path: "{{ item }}"
+ state: absent
+ with_items:
+ - /etc/maat-redis.conf
+ - /usr/lib/systemd/system/maat-redis.service
+
+ - name: remove redis
+ yum:
+ name: redis
+ state: absent
+
diff --git a/tasks/uninstall/uninstall_node-exporter.yml b/tasks/uninstall/uninstall_node-exporter.yml new file mode 100644 index 0000000..e30e809 --- /dev/null +++ b/tasks/uninstall/uninstall_node-exporter.yml @@ -0,0 +1,26 @@ +- hosts: adc_mxn + remote_user: root + tasks: + + - name: "stop node-exporter service" + shell: systemctl stop node-exporter + ignore_errors: true + + - name: "disable node-exporter service" + shell: systemctl disable node-exporter + ignore_errors: true + + - name: "remove node-exporter service" + shell: rm /usr/lib/systemd/system/node-exporter.service + ignore_errors: true + + - name: 'reset node-exporter in mxn' + shell: systemctl daemon-reload; systemctl reset-failed node-exporter + ignore_errors: true + + + - name: 'start adc-exporter-node service' + systemd: + name: adc-exporter-node + state: started + enabled: yes diff --git a/tasks/uninstall/uninstall_redis40u.yml b/tasks/uninstall/uninstall_redis40u.yml new file mode 100644 index 0000000..54f54c6 --- /dev/null +++ b/tasks/uninstall/uninstall_redis40u.yml @@ -0,0 +1,14 @@ +- hosts: adc_mcn3 + remote_user: root + tasks: + - name: 'redis service stop' + systemd: + name: redis + enabled: no + daemon_reload: yes + state: stopped + + - name: remove the redis40u + yum: + name: redis40u + state: absent diff --git a/tasks/uninstall/uninstall_rpm_node-exporter.yml b/tasks/uninstall/uninstall_rpm_node-exporter.yml new file mode 100644 index 0000000..07955c7 --- /dev/null +++ b/tasks/uninstall/uninstall_rpm_node-exporter.yml @@ -0,0 +1,7 @@ +- hosts: adc_mxn + remote_user: root + tasks: + - name: remove the node-exporter + yum: + name: node-exporter + state: absent diff --git a/tasks/verify/verify_process_md5_hash.yml b/tasks/verify/verify_process_md5_hash.yml new file mode 100644 index 0000000..1163412 --- /dev/null +++ b/tasks/verify/verify_process_md5_hash.yml @@ -0,0 +1,13 @@ +- hosts: adc_mcn0 + remote_user: root + tasks: + - name: "verify sapp md5 in mcn0" + shell: md5sum /home/mesasoft/sapp_run/sapp + register: sapp_md5sum + + - name: assert + assert: + that: + - sapp_md5sum.stdout.find('1ca2eb92e4269066c6a056e41bb394b3') != -1 + fail_msg: "FAIL" + success_msg: "PASS" diff --git a/tasks/verify/verify_systemctl_sapp.yml b/tasks/verify/verify_systemctl_sapp.yml new file mode 100644 index 0000000..37c0496 --- /dev/null +++ b/tasks/verify/verify_systemctl_sapp.yml @@ -0,0 +1,13 @@ +- hosts: adc_mcn0 + remote_user: root + tasks: + - name: "register systemctl status sapp result" + shell: systemctl status sapp + register: sapp_results + + - name: assert + assert: + that: + - sapp_results.stdout.find('active (running)') != -1 + fail_msg: "FAIL" + success_msg: "PASS" diff --git a/tasks/verify/verify_systemctl_tfe.yml b/tasks/verify/verify_systemctl_tfe.yml new file mode 100644 index 0000000..4204c15 --- /dev/null +++ b/tasks/verify/verify_systemctl_tfe.yml @@ -0,0 +1,16 @@ +- hosts: + - adc_mcn1 + - adc_mcn2 + - adc_mcn3 + remote_user: root + tasks: + - name: "register systemctl status tfe result" + shell: systemctl status tfe + register: tfe_results + + - name: assert + assert: + that: + - tfe_results.stdout.find('active (running)') != -1 + fail_msg: "FAIL" + success_msg: "PASS" diff --git a/tasks/verify/verify_tfe_md5_hash.yml b/tasks/verify/verify_tfe_md5_hash.yml new file mode 100644 index 0000000..80e23be --- /dev/null +++ b/tasks/verify/verify_tfe_md5_hash.yml @@ -0,0 +1,16 @@ +- hosts: + - adc_mcn1 + - adc_mcn2 + - adc_mcn3 + remote_user: root + tasks: + - name: "verify tfe md5 in mcn0" + shell: md5sum /opt/tsg/tfe/bin/tfe + register: tfe_md5sum + + - name: assert + assert: + that: + - tfe_md5sum.stdout.find('0f45d2844dbff2edbde44bab0359cead') != -1 + fail_msg: "FAIL" + success_msg: "PASS" diff --git a/tasks/verify/verify_tsg_diagnose.yml b/tasks/verify/verify_tsg_diagnose.yml new file mode 100644 index 0000000..0a927bb --- /dev/null +++ b/tasks/verify/verify_tsg_diagnose.yml @@ -0,0 +1,13 @@ +- hosts: adc_mcn0 + remote_user: root + tasks: + - name: "register tsg-diagnose exec result" + shell: docker exec -it unittest_tsg-diagnose /bin/sh -c 'python3 /root/unittest/tsg_diagnose.py' + register: tsgdiagnoseresults + + - name: assert + assert: + that: + - tsgdiagnoseresults.stdout.find('FAIL') == -1 + fail_msg: "FAIL" + success_msg: "PASS" diff --git a/tasks/verify/verify_tsg_diagnose_once.yml b/tasks/verify/verify_tsg_diagnose_once.yml new file mode 100644 index 0000000..9b8f9ae --- /dev/null +++ b/tasks/verify/verify_tsg_diagnose_once.yml @@ -0,0 +1,31 @@ +- hosts: adc_mcn0 + remote_user: root + tasks: + - name: 'mcn0 start tsg-diagnose service' + systemd: + name: tsg-diagnose + state: started + enabled: yes + +- hosts: adc_mcn0 + remote_user: root + tasks: + - name: "register tsg-diagnose exec result" + shell: docker exec -it unittest_tsg-diagnose /bin/sh -c 'python3 /root/unittest/tsg_diagnose.py' + register: tsgdiagnoseresults + + - name: assert + assert: + that: + - tsgdiagnoseresults.stdout.find('FAIL') == -1 + fail_msg: "FAIL" + success_msg: "PASS" + +- hosts: adc_mcn0 + remote_user: root + tasks: + - name: 'mcn0 stop tsg-diagnose service' + systemd: + name: tsg-diagnose + state: stopped + enabled: no |
