From 27999d407e4ecdf5d79e6f712b179f93b8c9850c Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Thu, 30 Nov 2017 06:41:06 +0000 Subject: [PATCH] Move uninstall tasks to its own file This cleans up the main tasks file. --- tasks/main.yml | 28 +--------------------------- tasks/uninstall.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 tasks/uninstall.yml diff --git a/tasks/main.yml b/tasks/main.yml index dc7aad9..abeafdf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,33 +1,7 @@ --- - when: ipsec_uninstall_tunnels|bool or ipsec_upgrade_tunnels|bool block: - - name: Find tunnel configurations to delete - find: - paths: /etc/ipsec.d/ - patterns: overcloud-* - register: configs_to_delete - - - name: Remove tunnel configurations - file: - path: "{{ item.path }}" - state: absent - with_items: "{{ configs_to_delete.files }}" - notify: - - Restart ipsec - - - name: Find policy configurations to delete - find: - paths: /etc/ipsec.d/policies/ - patterns: overcloud-* - register: policies_to_delete - - - name: Remove tunnel configurations - file: - path: "{{ item.path }}" - state: absent - with_items: "{{ policies_to_delete.files }}" - notify: - - Restart ipsec + - include: uninstall.yml - when: not ipsec_uninstall_tunnels|bool or ipsec_upgrade_tunnels|bool block: diff --git a/tasks/uninstall.yml b/tasks/uninstall.yml new file mode 100644 index 0000000..ed350e5 --- /dev/null +++ b/tasks/uninstall.yml @@ -0,0 +1,28 @@ +--- +- name: Find tunnel configurations to delete + find: + paths: /etc/ipsec.d/ + patterns: overcloud-* + register: configs_to_delete + +- name: Remove tunnel configurations + file: + path: "{{ item.path }}" + state: absent + with_items: "{{ configs_to_delete.files }}" + notify: + - Restart ipsec + +- name: Find policy configurations to delete + find: + paths: /etc/ipsec.d/policies/ + patterns: overcloud-* + register: policies_to_delete + +- name: Remove tunnel configurations + file: + path: "{{ item.path }}" + state: absent + with_items: "{{ policies_to_delete.files }}" + notify: + - Restart ipsec