-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update basic-service uninstall logic
- Loading branch information
Showing
4 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,71 @@ | ||
--- | ||
- name: Uninstall service container | ||
community.docker.docker_container: | ||
name: "{{ name }}" | ||
# --- Storage Handlers --- | ||
- name: Remove host data directory | ||
ansible.builtin.file: | ||
path: "{{ hostDataDir }}" | ||
state: absent | ||
purge_networks: true | ||
listen: Container uninstall | ||
when: hostDataDir is defined | ||
|
||
- name: Remove generated service config files | ||
become: true | ||
- name: Remove generated config files | ||
ansible.builtin.file: | ||
path: "{{ work_dir }}/{{ item.value.destinationPath }}" | ||
path: "{{ item.value.destinationPath }}" | ||
state: absent | ||
with_dict: "{{ config }}" | ||
listen: Container uninstall | ||
|
||
- name: Remove service data directory | ||
become: true | ||
- name: Remove config directories | ||
ansible.builtin.file: | ||
path: "{{ hostDataDir }}" | ||
path: "{{ item.value.destinationPath | dirname }}" | ||
state: absent | ||
with_dict: "{{ config }}" | ||
|
||
# --- Network Handlers --- | ||
- name: Remove service ingress iptables rules | ||
ansible.builtin.iptables: | ||
chain: INPUT | ||
protocol: tcp | ||
destination_ports: "{{ ingress_list }}" | ||
jump: ACCEPT | ||
state: absent | ||
|
||
# --- Binary Handlers --- | ||
- name: Remove destination directory | ||
ansible.builtin.file: | ||
path: "{{ destination_directory }}" | ||
state: absent | ||
|
||
- name: Remove temporary binary file | ||
ansible.builtin.file: | ||
path: "/tmp/{{ binary_file_name }}" | ||
state: absent | ||
|
||
- name: Remove extracted files or moved binary | ||
ansible.builtin.file: | ||
path: "{{ destination_directory }}/{{ binary_file_name_override | default(binary_file_name) }}" | ||
state: absent | ||
|
||
# --- Systemd Handlers --- | ||
- name: Remove the systemd unit file | ||
ansible.builtin.include_role: | ||
name: ansible-role-systemd | ||
vars: | ||
unit_config: | ||
- name: "{{ name }}" | ||
state: absent | ||
enabled: false | ||
perform_uninstall: true | ||
when: setup_mode == 'systemd' | ||
|
||
# --- Container Handlers --- | ||
- name: Container uninstall | ||
community.docker.docker_container: | ||
name: "{{ name }}" | ||
state: absent | ||
when: setup_mode == 'container' | ||
|
||
# --- Kubernetes Handlers --- | ||
- name: Uninstall Helm release | ||
kubernetes.core.helm: | ||
name: "{{ name }}" | ||
state: absent | ||
listen: Container uninstall | ||
release_namespace: "{{ helm_namespace }}" | ||
when: setup_mode == 'k8s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters