Skip to content

Commit

Permalink
[FIX] fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ismoilovdevml committed Sep 18, 2024
1 parent 2cd88bb commit 8e6d1bb
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 20 deletions.
6 changes: 4 additions & 2 deletions Ansible/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This playbook installs Docker on multiple Linux operating systems and provides a
### Install Docker
Run the following command to install Docker on your servers:
```bash
ansible-galaxy collection install community.general
ansible-playbook -i inventory.ini ./install_docker.yml
```
# Clean up and Uninstall Docker
Expand All @@ -23,13 +24,14 @@ This will:


# πŸ’» Supported Linux Operating Systems
This playbook supports the following Linux distributions:
* 🐧 **Debian:** 11,12
* 🐧 **Ubuntu:** 20.04,22.04
* 🐧 **RHEL:** 7,8
* 🐧 **Fedora:** 39,40

# βœ… Tested Operating Systems

The playbook has been tested on the following OS versions:
* βœ…**Debian:** 11,12
* βœ…**Ubuntu:** 20.04,22.04
* βœ…**RHEL:** 7,8
Expand All @@ -38,4 +40,4 @@ This will:
* βœ… ansible [core 2.16.3]
* ❗️ ansible [core 2.17.3] (compatibility issues)

> Note: The playbook assumes you are running Ansible as the root user. For non-root users, ensure you have become privileges configured.
> Note: The playbook assumes you are running Ansible as the root user. For non-root users, ensure you have `become` privileges configured.
41 changes: 41 additions & 0 deletions Ansible/jenkins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# πŸ“‹ Jenkins Installation and Uninstallation Playbook

This Ansible playbook allows for the installation and uninstallation of Jenkins across multiple Linux distributions. It includes cleanup procedures that remove all Jenkins-related files, services, and configurations.

## πŸ› οΈ Usage

### Install Jenkins
To install Jenkins on your servers, execute the following command:
```bash
ansible-playbook -i inventory.ini ./install_jenkins.yml
```
# Uninstall Jenkins and Clean Up
To uninstall Jenkins and clean up associated files and services from your servers, use the following command:
```bash
ansible-playbook -i inventory.ini ./uninstall_jenkins.yml
```
This will:
* Stop all Jenkins services.
* Remove Jenkins packages.
* Remove Jenkins repositories and GPG keys.
* Clean up Jenkins directories (logs, cache, data).


# πŸ’» Supported Linux Operating Systems
This playbook supports the following Linux distributions:
* 🐧 **Debian:** 11,12
* 🐧 **Ubuntu:** 20.04,22.04
* 🐧 **RHEL:** 7,8
* 🐧 **Fedora:** 39,40

# βœ… Tested Operating Systems
The playbook has been tested on the following OS versions:
* βœ…**Debian:** 11,12
* βœ…**Ubuntu:** 20.04,22.04
* βœ…**RHEL:** 7,8

# βš™οΈ Supported Ansible Versions
* βœ… ansible [core 2.16.3]
* ❗️ ansible [core 2.17.3] (compatibility issues)

> Note: The playbook assumes you are running Ansible as the root user. For non-root users, ensure you have `become` privileges configured.
37 changes: 25 additions & 12 deletions Ansible/jenkins/uninstall_jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@

tasks:

- name: Stop Jenkins on Debian/Ubuntu
- name: Check if Jenkins service exists on Debian/Ubuntu
when: ansible_os_family == "Debian"
shell: |
systemctl list-units --type service --all | grep -w jenkins
register: jenkins_service_exists_debian
failed_when: jenkins_service_exists_debian.rc > 1
ignore_errors: yes

- name: Stop Jenkins on Debian/Ubuntu if running
when: ansible_os_family == "Debian" and jenkins_service_exists_debian.rc == 0
systemd:
name: jenkins
state: stopped
ignore_errors: yes

- name: Uninstall Jenkins and Java on Debian/Ubuntu
when: ansible_os_family == "Debian"
Expand Down Expand Up @@ -60,12 +67,19 @@
recurse: yes
force: yes

- name: Stop Jenkins on Red Hat/Fedora/Alma/Rocky
- name: Check if Jenkins service exists on Red Hat/Fedora/Alma/Rocky
when: ansible_os_family == "RedHat"
shell: |
systemctl list-units --type service --all | grep -w jenkins
register: jenkins_service_exists_rhel
failed_when: jenkins_service_exists_rhel.rc > 1
ignore_errors: yes

- name: Stop Jenkins on Red Hat/Fedora/Alma/Rocky if running
when: ansible_os_family == "RedHat" and jenkins_service_exists_rhel.rc == 0
systemd:
name: jenkins
state: stopped
ignore_errors: yes

- name: Uninstall Jenkins and Java on Red Hat/Fedora/Alma/Rocky
when: ansible_os_family == "RedHat"
Expand All @@ -82,20 +96,19 @@
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
- name: Remove Jenkins GPG key on Red Hat/Fedora/Alma/Rocky
when: ansible_os_family == "RedHat" and jenkins_gpg_key is defined and jenkins_gpg_key is not none
ansible.builtin.rpm_key:
state: absent
key: gpg-pubkey
register: jenkins_gpg_key

- 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
- /var/lib/jenkins
6 changes: 3 additions & 3 deletions Ansible/minio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ To clean up and uninstall MinIO, use the following command:
ansible-playbook -i inventory.ini ./uninstall_minio.yml
```


# πŸ’» Supported Linux Operating Systems
This playbook supports the following Linux distributions:
* 🐧 **Debian:** 11,12
* 🐧 **Ubuntu:** 20.04,22.04
* 🐧 **RHEL:** 7,8
* 🐧 **Fedora:** 39,40

# βœ… Tested Operating Systems

The playbook has been tested on the following OS versions:
* βœ…**Debian:** 11,12
* βœ…**Ubuntu:** 20.04,22.04
* βœ…**RHEL:** 7,8
Expand All @@ -40,4 +40,4 @@ ansible-playbook -i inventory.ini ./uninstall_minio.yml
* βœ… ansible [core 2.16.3]
* ❗️ ansible [core 2.17.3] (compatibility issues)

> Note: The playbook assumes you are running Ansible as the `root` user.
> Note: The playbook assumes you are running Ansible as the root user. For non-root users, ensure you have `become` privileges configured.
2 changes: 1 addition & 1 deletion Ansible/minio/install_minio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
hosts: minio_servers
become: yes
vars_files:
- main.yml
- vars.yml
tasks:

- name: Install wget on multiple OS
Expand Down
2 changes: 1 addition & 1 deletion Ansible/minio/uninstall_minio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
hosts: minio_servers
become: yes
vars_files:
- main.yml
- vars.yml
tasks:

- name: Check if MinIO service exists
Expand Down
3 changes: 2 additions & 1 deletion Ansible/update-upgrade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ ansible-playbook -i inventory.ini ./update_upgrade_tools.yml
```

# πŸ’» Supported Linux Operating Systems
This playbook supports the following Linux distributions:
* 🐧 **Debian:** 11,12
* 🐧 **Ubuntu:** 20.04,22.04
* 🐧 **RHEL:** 7,8
* 🐧 **Fedora:** 39,40

# βœ… Tested Operating Systems

The playbook has been tested on the following OS versions:
* βœ…**Debian:** 11,12
* βœ…**Ubuntu:** 20.04,22.04
* βœ…**RHEL:** 7,8
Expand Down

0 comments on commit 8e6d1bb

Please sign in to comment.