forked from extern/innernet-playbook
improve uninstallation mechanism and prevent accidental removal
This commit is contained in:
parent
e0b5bf5ebb
commit
75c2682bef
14
deploy.yml
14
deploy.yml
@ -6,6 +6,20 @@
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
tasks:
|
||||
- pause:
|
||||
prompt: "You are using a function to UNINSTALL innernet on the chosen hosts {{ play_hosts }}. Continue? (yes/no)?"
|
||||
tags: [never, uninstall]
|
||||
register: uninstall_confirm
|
||||
delegate_to: localhost
|
||||
run_once: yes
|
||||
|
||||
- fail:
|
||||
msg: Aborted uninstallation of innernet.
|
||||
tags: [never, uninstall]
|
||||
when: not uninstall_confirm.user_input | bool
|
||||
delegate_to: localhost
|
||||
run_once: yes
|
||||
|
||||
- name: Get innernet-server hostname from inventory groups
|
||||
set_fact:
|
||||
# Assuming that we only have one innernet server, we take the first
|
||||
|
@ -18,7 +18,7 @@
|
||||
- ['-fsfe-be', '']
|
||||
|
||||
- name: Gather which packages are installed on the client
|
||||
tags: [update]
|
||||
tags: [update, uninstall]
|
||||
package_facts:
|
||||
manager: auto
|
||||
|
||||
@ -31,12 +31,21 @@
|
||||
- wireguard-tools
|
||||
- ufw
|
||||
|
||||
- name: Remove existing innernet
|
||||
- name: Remove existing innernet configuration on client
|
||||
tags: [never, uninstall]
|
||||
expect:
|
||||
command: "innernet uninstall {{ network_name }}"
|
||||
responses:
|
||||
(?i)delete: "yes"
|
||||
when: "'innernet' in ansible_facts.packages"
|
||||
|
||||
- name: Remove innernet package on client
|
||||
tags: [never, uninstall]
|
||||
apt:
|
||||
name: innernet
|
||||
state: absent
|
||||
purge: yes
|
||||
when: "'innernet' in ansible_facts.packages"
|
||||
|
||||
- name: Install innernet package on client
|
||||
tags: [update]
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
---
|
||||
- name: Gather which packages are installed on the server
|
||||
tags: [update]
|
||||
tags: [update, uninstall]
|
||||
package_facts:
|
||||
manager: auto
|
||||
|
||||
@ -18,12 +18,21 @@
|
||||
- wireguard-tools
|
||||
- ufw
|
||||
|
||||
- name: Remove existing innernet
|
||||
- name: Remove existing innernet configuration
|
||||
tags: [never, uninstall]
|
||||
expect:
|
||||
command: "innernet-server uninstall {{ network_name }}"
|
||||
responses:
|
||||
(?i)delete: "yes"
|
||||
when: "'innernet-server' in ansible_facts.packages"
|
||||
|
||||
- name: Remove innernet package on server
|
||||
tags: [never, uninstall]
|
||||
apt:
|
||||
name: innernet-server
|
||||
state: absent
|
||||
purge: yes
|
||||
when: "'innernet-server' in ansible_facts.packages"
|
||||
|
||||
- name: Install innernet package on server
|
||||
tags: [update]
|
||||
|
Loading…
Reference in New Issue
Block a user