Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
df536da
Update docker-cheatsheet.md
ThashmikaX Jul 2, 2025
876389f
Merge pull request #1 from ThashmikaX/patch-1
ThashmikaX Jul 2, 2025
c0087ff
Update docker-cheatsheet.md
ThashmikaX Jul 2, 2025
6f6cf61
Update linux-cheatsheet.md
ThashmikaX Jul 4, 2025
1fbae95
Update docker-cheatsheet.md
ThashmikaX Jul 4, 2025
1cd2e06
Create jenkins-cheatsheet.md
ThashmikaX Jul 4, 2025
ff3d768
Update docker-cheatsheet.md
ThashmikaX Jul 4, 2025
e52aa1a
Update docker-cheatsheet.md
ThashmikaX Jul 4, 2025
cfd2075
Update docker-cheatsheet.md
ThashmikaX Jul 7, 2025
6861c23
Update docker-cheatsheet.md
ThashmikaX Jul 8, 2025
17d8a73
Update docker-cheatsheet.md
ThashmikaX Jul 8, 2025
87716a4
Update docker-cheatsheet.md
ThashmikaX Jul 16, 2025
5fac9b9
Merge pull request #3 from ThashmikaX/ThashmikaX-patch-1
ThashmikaX Jul 24, 2025
8666926
Merge pull request #2 from ThashmikaX/ThashmikaX-patch-2
ThashmikaX Jul 24, 2025
db40be6
Update README.md
ThashmikaX Jul 24, 2025
988aba0
Merge pull request #4 from ThashmikaX/ThashmikaX-patch-1
ThashmikaX Jul 24, 2025
e7d6068
Update docker-cheatsheet.md
ThashmikaX Aug 12, 2025
cdf2213
Update docker-cheatsheet.md
ThashmikaX Aug 22, 2025
594609a
Modify Docker clean reset command in cheatsheet
ThashmikaX Sep 3, 2025
bf141ef
Add git reset and push command for history rewrite
ThashmikaX Dec 29, 2025
d261480
Add Ansible CheatSheet with common commands
ThashmikaX Jan 27, 2026
736b63d
Add ansible-cheatsheet.md link to README
ThashmikaX Jan 27, 2026
b1b7751
Update Ansible cheatsheet link in README.md
ThashmikaX Jan 27, 2026
02afc35
Add additional git config commands to cheatsheet
ThashmikaX Feb 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions CheatSheets/Ansible_CheatSheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
title: Ansible CheatSheet
description: The most commonly used Ansible commands are given here.
created: 2026-01-27
---

## Table of Contents

- [Ansible CheatSheet for Developers](#ansible-cheatsheet-for-developers)
- [Check Ansible Setup and Configuration](#check-ansible-setup-and-configuration)
- [Inventory and Connectivity](#inventory-and-connectivity)
- [Running Ad-hoc Commands](#running-ad-hoc-commands)
- [Playbooks](#playbooks)
- [Roles](#roles)
- [Variables and Facts](#variables-and-facts)
- [Ansible Galaxy](#ansible-galaxy)
- [Ansible Vault](#ansible-vault)
- [Miscellaneous Commands](#miscellaneous-commands)

# Ansible CheatSheet for Developers

## Check Ansible Setup and Configuration

| Command | Description |
| :-----------------------------: | -------------------------------------------------------- |
| `ansible --version` | Display Ansible version and configuration paths |
| `ansible-config list` | List all Ansible configuration options |
| `ansible-config view` | View the active Ansible configuration |
| `ansible-doc -l` | List all available Ansible modules |

**[🔼Back to Top](#table-of-contents)**

## Inventory and Connectivity

| Command | Description |
| :---------------------------------------------------: | --------------------------------------------------------- |
| `ansible all -i inventory -m ping` | Test connectivity to all hosts |
| `ansible all -m ping` | Ping all hosts using default inventory |
| `ansible web -i inventory -m ping` | Ping hosts in the `web` group |
| `ansible-inventory --list -y` | Display inventory in YAML format |
| `ansible-inventory --graph` | Display inventory as a graph |

**[🔼Back to Top](#table-of-contents)**

## Running Ad-hoc Commands

| Command | Description |
| :-----------------------------------------------------------------: | -------------------------------------------------------- |
| `ansible all -m shell -a "uptime"` | Run shell command on all hosts |
| `ansible web -m command -a "df -h"` | Run command module on `web` hosts |
| `ansible all -m copy -a "src=a.txt dest=/tmp/a.txt"` | Copy file to remote hosts |
| `ansible all -m yum -a "name=httpd state=present" -b` | Install package using privilege escalation |
| `ansible all -m service -a "name=httpd state=started" -b` | Start a service |

**[🔼Back to Top](#table-of-contents)**

## Playbooks

| Command | Description |
| :---------------------------------------------: | --------------------------------------------------------- |
| `ansible-playbook site.yml` | Run a playbook |
| `ansible-playbook site.yml -i inventory` | Run playbook with specific inventory |
| `ansible-playbook site.yml --check` | Dry run (check mode) |
| `ansible-playbook site.yml --diff` | Show differences when files change |
| `ansible-playbook site.yml -l web` | Limit execution to `web` hosts |
| `ansible-playbook site.yml -t install` | Run tasks with specific tag |
| `ansible-playbook site.yml --start-at-task "X"` | Start execution from a specific task |

**[🔼Back to Top](#table-of-contents)**

## Roles

| Command | Description |
| :---------------------------------------: | --------------------------------------------------- |
| `ansible-galaxy init my_role` | Create a new role structure |
| `ansible-galaxy list` | List installed roles |
| `ansible-galaxy install nginxinc.nginx` | Install role from Ansible Galaxy |
| `ansible-galaxy remove nginxinc.nginx` | Remove an installed role |

**[🔼Back to Top](#table-of-contents)**

## Variables and Facts

| Command | Description |
| :---------------------------------------------------: | --------------------------------------------------------- |
| `ansible all -m setup` | Gather facts from all hosts |
| `ansible all -m setup -a "filter=ansible_os_family"` | Filter specific facts |
| `ansible-playbook site.yml -e "env=prod"` | Pass extra variables via CLI |
| `ansible-playbook site.yml -e @vars.yml` | Load variables from a file |

**[🔼Back to Top](#table-of-contents)**

## Ansible Galaxy

| Command | Description |
| :-------------------------------------------: | ----------------------------------------------------- |
| `ansible-galaxy search mysql` | Search roles on Ansible Galaxy |
| `ansible-galaxy install geerlingguy.mysql` | Install role from Galaxy |
| `ansible-galaxy collection list` | List installed collections |
| `ansible-galaxy collection install community.aws` | Install a collection |

**[🔼Back to Top](#table-of-contents)**

## Ansible Vault

| Command | Description |
| :------------------------------------------: | ----------------------------------------------------- |
| `ansible-vault create secrets.yml` | Create an encrypted file |
| `ansible-vault edit secrets.yml` | Edit an encrypted file |
| `ansible-vault encrypt vars.yml` | Encrypt an existing file |
| `ansible-vault decrypt vars.yml` | Decrypt a file |
| `ansible-playbook site.yml --ask-vault-pass` | Run playbook with vault password prompt |

**[🔼Back to Top](#table-of-contents)**

## Miscellaneous Commands

| Command | Description |
| :---------------------------------------: | ------------------------------------------------------- |
| `ansible-doc yum` | Show documentation for a module |
| `ansible-playbook site.yml -vvv` | Run playbook with verbose output |
| `ansible localhost -m debug -a "var=hostvars"` | Debug variables |

**[🔼Back to Top](#table-of-contents)**
27 changes: 24 additions & 3 deletions CheatSheets/docker-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ created: 2022-10-22
- [Docker CheatSheet for Developers](#docker-cheatsheet-for-developers)
- [Run a New Container](#run-a-new-container)
- [Manage Containers](#manage-containers)
- [Manage Compose](#manage-compose)
- [Manage Images](#manage-images)
- [Manage System](#manage-system)
- [Info and Stats](#info-and-stats)
Expand Down Expand Up @@ -50,6 +51,19 @@ created: 2022-10-22

**[🔼Back to Top](#table-of-contents)**

## Manage Compose

| Command | Description |
| -------------------------------------- | ---------------------------------------- |
| `docker compose build --no-cache` | Build docker compose with no-cache |
| `docker compose ls` | Show a list of running compose |
| `docker compose up -d --force-recreate` | Down and again up existing compose |
| `docker-compose --env-file .env.server --env-file .env up -d --build` | Up docker compose with env file |
| `docker compose -p <project_name> down` | Down compose from any directory |
| `docker-compose -f docker-compose.yml -f docker-compose.traefik.yml up -d` | Up docker compose with custom overide file(default overide will not effect) | |

**[🔼Back to Top](#table-of-contents)**

## Manage Images

| Command | Description |
Expand All @@ -70,9 +84,15 @@ created: 2022-10-22

## Manage System

| Command | Description |
| --------------------------------- | ---------------------------------------- |
| `docker system prune --all --force` | Removes everything that is not in use |
| Command | Description |
| ------- | ----------- |
| `docker system prune --all --force` | Removes everything that is not in use |
| `docker builder prune` | Removes build cache |
| `docker container prune` | Removes stopped containers |
| `docker network create traefik-public` | Creates a Docker network named **traefik-public** |
| `docker network rm <network_name_or_id>` | Removes a Docker network |
| `sudo systemctl stop docker && sudo rm -rf /var/lib/docker && sudo rm -rf /var/lib/containerd && sudo systemctl start docker` | Performs a **clean reset** of Docker (⚠ removes everything) |


**[🔼Back to Top](#table-of-contents)**

Expand All @@ -87,6 +107,7 @@ created: 2022-10-22
| `docker inspect NAME` | Get detailed info about an object |
| `docker diff CONTAINER` | Show all modified files in a container |
| `docker port CONTAINER` | Show mapped ports of a container |
| `docker system df` | Show storage usage in docker |

**[🔼Back to Top](#table-of-contents)**

2 changes: 2 additions & 0 deletions CheatSheets/git-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ created: 2022-10-18
| `git reset --soft "commit-hash"` | Take my changes and go back/kill the commit I made but the file will be staged with the change ready to be committed again |
| `git reset --mixed "commit-hash"` | Return/Kill the commit too but it returns the files to before staged i.e. modified but it will still return |
| `git reset --hard "commit-hash"` | It will simply ignore the existence of this commit and undo everything that was done in this commit. <br /> It is a very rough reset and is normally used before pushing your commit to the remote repository. |
| `git reset --hard HEAD~1
git push --force"` | If you already pushed and want to rewrite history |

**[🔼Back to Top](#table-of-contents)**

Expand Down
21 changes: 21 additions & 0 deletions CheatSheets/jenkins-cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Jenkins CheatSheet
description: The most commonly used jenkins commands are given here.
created: 2022-10-22
---

## Table of Contents

- [Jenkins CheatSheet for Developers](#docker-cheatsheet-for-developers)
- [Manage Jenkins on Linux](#manage-jenkins-on-linux)


# Jenkins CheatSheet for Developers

## Manage Jenkins on Linux

| Command | Description |
| ---------------------------------------------- | ---------------------------------------- |
| `sudo systemctl restart jenkins` | Restart Jenkins on Linux Server |

**[🔼Back to Top](#table-of-contents)**
2 changes: 2 additions & 0 deletions CheatSheets/linux-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ created: 2022-10-21
| `fdisk -l` | Display disks partitions sizes and types|
| `du -ah` | Display disk usage for all files and directories in human readable format|
| `du -sh` | Display total disk usage off the current directory|
| `sudo apt-get install ncdu` | Install text based storage vizualizer|
| `sudo ncdu /` | Vizualize storage|

**[🔼Back to Top](#table-of-contents)**

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ A Collection of programming [CheatSheets](./CheatSheets/) for developers to quic
| __[docker-cheatsheet.md](./CheatSheets/docker-cheatsheet.md)__ | __[terraform-cheatsheet.md](./CheatSheets/terraform-cheatsheet.md)__ | __[regex-cheatsheet.md](./CheatSheets/regex-cheatsheet.md)__ |
| __[conda-cheatsheet.md](./CheatSheets/conda-cheatsheet.md)__ | __[pandas-cheatsheet.md](./CheatSheets/pandas-cheatsheet.md)__ | __[numpy-cheatsheet.md](./CheatSheets/Numpy-cheatsheet.md)__ |
| __[configure-react-cheatsheet.md](./CheatSheets/configure-react-cheatsheet.md)__ | __[react-cheatsheet.md](./CheatSheets/react-cheatsheet.md)__ | __[angular-cheatsheet.md](./CheatSheets/angular-cheatsheet.md)__ |
| __[extension-cheatsheet.md](./CheatSheets/extension-cheatsheet.md)__ | __[sklearn-cheatsheet.md](./CheatSheets/sklearn-cheatsheet.md)__ | |
| __[extension-cheatsheet.md](./CheatSheets/extension-cheatsheet.md)__ | __[sklearn-cheatsheet.md](./CheatSheets/sklearn-cheatsheet.md)__ | __[jenkins-cheatsheet.md](./CheatSheets/jenkins-cheatsheet.md)__ |
| __[ansible-cheatsheet.md](./CheatSheets/Ansible_CheatSheet.md)__ | | |

</div>

Expand Down Expand Up @@ -107,6 +108,7 @@ A Collection of programming [CheatSheets](./CheatSheets/) for developers to quic
- [yarn-cheatsheet.md](./CheatSheets/yarn-cheatsheet.md)
- [docker-cheatsheet.md](./CheatSheets/docker-cheatsheet.md)
- [terraform-cheatsheet.md](./CheatSheets/terraform-cheatsheet.md)
- [ansible-cheatsheet.md](./CheatSheets/Ansible_CheatSheet.md)
</details>

<details>
Expand Down