-
Notifications
You must be signed in to change notification settings - Fork 31
/
remove-hacluster.yml
44 lines (44 loc) · 1.34 KB
/
remove-hacluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
- hosts: hacluster
gather_facts: False
become: true
tasks:
# - name: Remove the hacluster docker stack
# docker_stack:
# state: absent
# name: hacluster
- name: "Get docker info"
shell: docker info
register: docker_info
changed_when: false
- name: Remove the hacluster docker stack
command: docker stack rm hacluster
when: docker_info.stdout.find("Swarm{{':'}} inactive") == -1
run_once: true
# - name: Dissasemble docker swarm
# docker_swarm:
# state: absent
# force: true
- name: Leave docker swarm
command: docker swarm leave --force
when: docker_info.stdout.find("Swarm{{':'}} inactive") == -1
# - name: Remove the home assistant directory
# file:
# state: absent
# path: "/var/hacluster/homeassistant/"
- name: Un-mount home assistant gluster volume
mount:
path: /var/hacluster/homeassistant
src: localhost:/gluster-homeassistant
fstype: glusterfs
state: absent
- name: Remove home assistant gluster volume
gluster_volume:
state: absent
force: yes
name: gluster-homeassistant
run_once: true
- name: Remove cron job to restart Avahi service every minute
cron:
name: "Restart Avahi for hacluster"
state: absent