summaryrefslogtreecommitdiffstats
path: root/roles/contiv/tasks/old_version_cleanup.yml
blob: 8b3d88096078e8c0d4fe80bff30692bac6eaf20a (plain)
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
---
- name: Old version cleanup | Check if old auth proxy service exists
  stat:
    path: /etc/systemd/system/auth-proxy.service
  register: auth_proxy_stat

- name: Old version cleanup | Stop old auth proxy
  service:
    name: auth-proxy
    enabled: no
    state: stopped
  when: auth_proxy_stat.stat.exists

# Note(NB): The new containerized contiv-etcd service uses the same data
# directory on the host, so etcd data is not lost.
- name: Old version cleanup | Check if old contiv-etcd service exists
  stat:
    path: /etc/systemd/system/contiv-etcd.service
  register: contiv_etcd_stat

- name: Old version cleanup | Stop old contiv-etcd
  service:
    name: contiv-etcd
    enabled: no
    state: stopped
  when: contiv_etcd_stat.stat.exists

- name: Old version cleanup | Delete old files
  file:
    state: absent
    path: "{{ item }}"
  with_items:
    - /etc/systemd/system/auth-proxy.service
    - /var/contiv/certs
    - /usr/bin/auth_proxy.sh
    - /etc/systemd/system/contiv-etcd.service
    - /etc/systemd/system/contiv-etcd.service.d

- include_tasks: old_version_cleanup_iptables.yml
  when: not contiv_has_firewalld and contiv_has_iptables

- include_tasks: old_version_cleanup_firewalld.yml
  when: contiv_has_firewalld