-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f103fd
commit 7eab0bb
Showing
3 changed files
with
171 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
- name: Uninstall Jenkins and cleanup on multiple OS | ||
hosts: jenkins_servers | ||
become: true | ||
vars: | ||
java_package_debian: openjdk-17-jre | ||
java_package_rhel: java-17-openjdk | ||
|
||
tasks: | ||
|
||
- name: Stop Jenkins on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" | ||
systemd: | ||
name: jenkins | ||
state: stopped | ||
ignore_errors: yes # Agar xizmat topilmasa ham, davom ettiradi | ||
|
||
- name: Uninstall Jenkins and Java on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" | ||
apt: | ||
name: | ||
- jenkins | ||
- "{{ java_package_debian }}" | ||
- fontconfig | ||
state: absent | ||
purge: yes | ||
|
||
- name: Remove Jenkins repo from sources list on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" | ||
ansible.builtin.file: | ||
path: /etc/apt/sources.list.d/jenkins.list | ||
state: absent | ||
|
||
- name: Remove Jenkins keyring on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" | ||
ansible.builtin.file: | ||
path: /usr/share/keyrings/jenkins-keyring.asc | ||
state: absent | ||
|
||
- name: Remove Jenkins cache and log directories on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: absent | ||
loop: | ||
- /var/cache/jenkins | ||
- /var/log/jenkins | ||
|
||
- name: Check if Jenkins data directory exists on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" | ||
stat: | ||
path: /var/lib/jenkins | ||
register: jenkins_data_dir | ||
|
||
- name: Remove Jenkins data directory on Debian/Ubuntu | ||
when: ansible_os_family == "Debian" and jenkins_data_dir.stat.exists | ||
ansible.builtin.file: | ||
path: /var/lib/jenkins | ||
state: absent | ||
recurse: yes | ||
force: yes | ||
|
||
- name: Stop Jenkins on Red Hat/Fedora/Alma/Rocky | ||
when: ansible_os_family == "RedHat" | ||
systemd: | ||
name: jenkins | ||
state: stopped | ||
ignore_errors: yes # Agar xizmat topilmasa ham, davom ettiradi | ||
|
||
- name: Uninstall Jenkins and Java on Red Hat/Fedora/Alma/Rocky | ||
when: ansible_os_family == "RedHat" | ||
yum: | ||
name: | ||
- jenkins | ||
- "{{ java_package_rhel }}" | ||
- fontconfig | ||
state: absent | ||
|
||
- name: Remove Jenkins repo file on Red Hat/Fedora/Alma/Rocky | ||
when: ansible_os_family == "RedHat" | ||
ansible.builtin.file: | ||
path: /etc/yum.repos.d/jenkins.repo | ||
state: absent | ||
|
||
- name: Remove Jenkins key on Red Hat/Fedora/Alma/Rocky | ||
when: ansible_os_family == "RedHat" | ||
ansible.builtin.command: | ||
cmd: rpm -e gpg-pubkey-$(rpm -q --qf "%{version}-%{release}\n" gpg-pubkey | grep jenkins | awk '{print $1}') | ||
ignore_errors: yes # Agar kalit topilmasa, davom ettiradi | ||
|
||
- name: Remove Jenkins cache, log, and data directories on Red Hat/Fedora/Alma/Rocky | ||
when: ansible_os_family == "RedHat" | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: absent | ||
recurse: yes | ||
force: yes | ||
loop: | ||
- /var/cache/jenkins | ||
- /var/log/jenkins | ||
- /var/lib/jenkins |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
- name: Uninstall and cleanup MinIO | ||
hosts: minio_servers | ||
become: yes | ||
vars_files: | ||
- main.yml | ||
tasks: | ||
|
||
- name: Stop and disable MinIO service | ||
systemd: | ||
name: minio | ||
state: stopped | ||
enabled: no | ||
ignore_errors: yes | ||
|
||
- name: Remove MinIO service file | ||
file: | ||
path: /usr/lib/systemd/system/minio.service | ||
state: absent | ||
|
||
- name: Reload systemd daemon | ||
systemd: | ||
daemon_reload: yes | ||
|
||
- name: Remove MinIO binary | ||
file: | ||
path: /usr/local/bin/minio | ||
state: absent | ||
|
||
- name: Remove MinIO environment file | ||
file: | ||
path: /etc/default/minio | ||
state: absent | ||
|
||
- name: Remove all files in MinIO data directory | ||
become: yes | ||
file: | ||
path: "{{ minio_directory }}" | ||
state: absent | ||
recurse: yes | ||
ignore_errors: yes | ||
|
||
- name: Remove MinIO data directory | ||
become: yes | ||
file: | ||
path: "{{ minio_directory }}" | ||
state: absent | ||
ignore_errors: yes | ||
|
||
- name: Remove MinIO user | ||
user: | ||
name: minio-user | ||
state: absent | ||
ignore_errors: yes | ||
become: yes | ||
|
||
- name: Remove MinIO group | ||
group: | ||
name: minio-user | ||
state: absent | ||
ignore_errors: yes | ||
become: yes | ||
|
||
- name: Remove wget on multiple OS | ||
package: | ||
name: wget | ||
state: absent | ||
purge: yes |