Skip to content

Repository files navigation

Ansible-Playbooks

Ansible Playbook Lint

A collection of Ansible Playbooks created and used during my learning journey with Ansible.

Overview

This repository contains a variety of Ansible playbooks that automate different system administration tasks. Each playbook is organized by category for easy navigation.

Usage

To run any of these playbooks, use the following command:

ansible-playbook path/to/playbook.yml -i your_inventory_file

Playbooks

Apt

  • APT Setup Unattended Upgrades: This playbook installs the unattended-upgrades package and configures your system to receive automatic updates for enhanced security and stability.

  • Disable Phased Updates: This playbook disables APT phased updates by writing a configuration file to /etc/apt/apt.conf.d/.

  • APT Packages Upgrade: This playbook upgrades all installed APT packages to their latest versions, keeping your system up-to-date.

Caddy

Cloudflared

  • Upgrade Cloudflared: This playbook upgrades the installed Cloudflared package to the latest version, ensuring you have the latest features and security patches.

Docker

  • Docker Cleanup: This playbook runs docker system prune -f to remove unused Docker data, including stopped containers, networks, images, and the build cache, thus freeing up disk space.

  • Deploy Docker Prune Timer: This playbook creates a Systemd Service/Timer for weekly pruning of unused Docker objects, ensuring that your Docker environment remains clean.

  • Install Docker & Docker Compose: This playbook installs Docker and Docker Compose, providing a robust platform for containerized applications.

  • Configure Docker Daemon: This playbook writes a daemon.json with log rotation settings (max-size 50m, max-file 5) and other Docker daemon options.

Fail2ban

  • Setup Fail2ban: This playbook installs Fail2ban and configures it to protect your server from brute-force attacks, particularly on SSH connections.

GoAccess

  • Generate Report: This playbook generates GoAccess report for Caddy Server.

Backup

  • Restic Backup: This playbook performs a Restic backup, initializing the repository if needed, and then executing the backup with specified paths and tags.

  • Restic Forget/Prune: This playbook runs the restic forget command to remove old backups based on a retention policy and then prunes the repository to reclaim space.

Install

  • Install Caddy Server: This playbook installs Caddy Server from the official Cloudsmith repository.

  • Install Dockmon Agent: This playbook installs and configures the Dockmon agent along with its docker-compose setup.

  • Install GoAccess: This playbook install GoAccess.

  • Install Nginx: This playbook install Nginx Web Server.

  • Install q: This playbook installs q, a powerful command-line DNS client, facilitating better DNS querying.

  • Install Rclone: This playbook installs Rclone, a command-line program to manage files on cloud storage.

  • Install Restic: This playbook installs Restic, a program that allows you to backup your files.

  • Install Autorestic: This playbook installs Autorestic, a wrapper around Restic that simplifies configuring and running backups.

  • Install Sendme: This playbook installs Sendme, a peer-to-peer file transfer tool built on iroh. Pin a version with -e sendme_version=v0.36.0 to skip the GitHub API call.

  • Install Zoxide: This playbook installs Zoxide, a command-line tool that provides a fuzzy finder for directories.

NTP

Prometheus

  • Install Blackbox Exporter: This playbook installs the Blackbox Exporter, which allows you to collect and report network metrics such as ICMP, HTTP, etc.

  • Install Fail2ban Exporter: This playbook installs the Fail2ban Exporter, which allows you to collect and report fail2ban metrics.

  • Install Node Exporter: This playbook installs the Node Exporter, which allows you to collect and report hardware and OS metrics exposed by the Linux operating system.

  • Install Smartctl Exporter: This playbook installs the Smartctl Exporter, which allows you to collect and report SMART metrics.

  • Install Systemd Exporter: This playbook installs the Systemd Exporter, which allows you to collect and report systemd metrics.

  • Install ZFS Exporter: This playbook installs the ZFS Exporter, which allows you to collect and report ZFS pool, dataset, and volume metrics.

Reporting

  • Server Inventory Report: This playbook collects and displays a comprehensive inventory report of your servers, including OS, virtualization type, architecture, CPU cores, RAM, disk size, and uptime.

Speedtest

  • Install Speedtest: This playbook installs the official CLI from Speedtest.net, allowing you to easily test and measure your internet connection performance.

SSH Keys

Sysctl

  • TCP Tweaks: This playbook increases system-wide and per-connection buffer limits to 128MB. It tunes net.core.rmem_max, net.core.wmem_max, net.ipv4.tcp_rmem, and net.ipv4.tcp_wmem to improve performance on high-bandwidth links.

  • UDP Buffer Size: This playbook increases UDP receive and send buffer sizes to ~7.5MB to optimize QUIC transfer speeds. It sets net.core.rmem_max and net.core.wmem_max.

Ubuntu

VnStat

  • Setup vnStat and Cron Job: This playbook installs vnStat and configures a cron job to update traffic statistics every minute, saving the output to a specified file.

Notes

Ensure you review each playbook and update any necessary variables according to your environment specifics before running them. This will help in avoiding unintended changes to your systems.

About

Collection of my Ansible Playbooks I create, and use while I learn Ansible.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors