You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Splunk-Install-Final/Deleted_SplunkForwarder.yml

58 lines
1.4 KiB

---
- name: Supprimer Splunk de Linux
hosts: splunk_uf_Linux
become: true
become_user: root
vars:
splunkforwarder_dir: "/opt/splunkforwarder"
tasks:
- name: Arrêter tous les processus Splunkforwarder en cours d'exécution
shell: "{{ splunkforwarder_dir }}/bin/splunk stop"
ignore_errors: true
- name: Désinstaller le service Splunk
shell: "{{ splunkforwarder_dir }}/bin/splunk disable boot-start"
- name: Supprimer le répertoire d'installation de Splunk
file:
path: "{{ splunkforwarder_dir }}"
state: absent
- name: Supprimer l'utilisateur Splunk et son groupe
user:
name: splunk
state: absent
ignore_errors: true
- name: Supprimer les entrées de démarrage automatique de Splunk
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/init.d/Splunkforwarder
- /etc/systemd/system/Splunk.service
- name: "Shutdown VM"
shell: shutdown -r now
- name: Wait for the reboot and reconnect
wait_for:
port: 22
search_regex: OpenSSH
delay: 10
timeout: 60
connection: local
- name: Check the Uptime of the servers
shell: "uptime"
register: Uptime
- debug: var=Uptime
#- name: "Shutdown VM"
#reboot:
#reboot_timeout: 300
#async: 0
#poll: 0