Ansible Cheatsheet

๐Ÿ“ฆ Inventory (hosts file) [webservers] web1.example.com web2.example.com [dbservers] db1.example.com ansible_user=ubuntu ansible_port=22 โ–ถ๏ธ Basic Playbook Structure - name: Example playbook hosts: webservers become: true vars: apache_port: 8080 tasks: - name: Install Apache apt: name: apache2 state: present update_cache: yes - name: Ensure Apache is running service: name: apache2 state: started enabled: true ๐Ÿ”ง Common Task Modules - name: Install packages apt: name: - git - curl state: present - name: Copy a file copy: src: ....

March 26, 2025 ยท 2 min

Kubernetes Cheat Sheet 1. Cluster and Configuration Management kubectl config get-contexts # List available contexts kubectl config use-context CONTEXT # Switch to a different cluster kubectl config view # Display current configuration 2. Working with Pods kubectl get pods # List all pods in the current namespace kubectl get pods -A # List pods in all namespaces kubectl describe pod POD_NAME # Show details of a specific pod kubectl logs POD_NAME # Retrieve logs from a pod (default container) kubectl logs POD_NAME -c CONTAINER # Retrieve logs from a specific container kubectl exec -it POD_NAME -- bash # Access a running pod interactively kubectl delete pod POD_NAME # Delete a pod kubectl delete pod --all # Delete all pods in the namespace 3....

March 21, 2025 ยท 4 min

Apache Cheat Sheet

Apache Configuration Cheat Sheet Test Apache configuration # Check if the Apache configuration is valid apachectl configtest Reload Apache # Reload Apache to apply changes without a full restart systemctl reload apache2 Restart Apache # Fully restart Apache service systemctl restart apache2 Get a list of available modules # List compiled-in modules apache2 -l # List all loaded modules apachectl -M Enable a website (site) # Enable a specific site configuration # Replace SITE with the name of the site configuration file a2ensite SITE Disable a website (site) # Disable a specific site configuration # Replace SITE with the name of the site configuration file a2dissite SITE

March 13, 2025 ยท 1 min

๐Ÿง Linux Debian Cheat Sheet

๐Ÿ“‚ File and Directory Operations # Lists files and directories ls # Lists files with details ls -l # Changes directory cd <directory_name> # Creates a new directory mkdir <directory_name> # Removes a file rm <file_name> # Removes a directory and its contents recursively rm -r <directory_name> # Copies a file or directory cp <source> <destination> # Moves or renames a file or directory mv <source> <destination> ๐Ÿ” System Information # Displays system information uname -a # Shows disk space usage df -h # Shows memory usage free -h # Displays running processes top ๐Ÿ› ๏ธ Package Management (APT) # Updates the package list sudo apt update # Upgrades installed packages to the latest versions sudo apt upgrade # Installs a package sudo apt install <package_name> # Removes a package sudo apt remove <package_name> # Removes unnecessary packages sudo apt autoremove ๐Ÿ”ง User and Permissions # Switches to another user su <username> # Adds a new user sudo adduser <username> # Changes file permissions chmod <permissions> <file_name> # Changes file ownership chown <user>:<group> <file_name> ๐Ÿ“ File Viewing and Editing # Displays the contents of a file cat <file_name> # Views a file with pagination less <file_name> # Edits a file using Nano editor nano <file_name> # Searches for a string in a file grep <string> <file_name> ๐Ÿš€ Networking # Shows IP address information ip a # Pings a host to check connectivity ping <host> # Displays active network connections netstat -tuln # Downloads a file from a URL wget <url>

March 10, 2025 ยท 2 min