- Jinja 94.1%
- Just 5.8%
- JavaScript 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .crow | ||
| .gitsv | ||
| ansibledoctor/templates/readme | ||
| examples | ||
| meta | ||
| roles | ||
| .ansible-lint | ||
| .ansibledoctor.yaml | ||
| .editorconfig | ||
| .editorconfig-checker.json | ||
| .gitignore | ||
| .markdownlint-cli2.yaml | ||
| .markdownlint.yaml | ||
| .pre-commit-config.yaml | ||
| .yamllint.yaml | ||
| commitlint.config.mjs | ||
| galaxy.yml | ||
| Justfile | ||
| README.md | ||
| renovate.json | ||
Ansible Collection "sysadmin"
Ansible collection for Linux system administration, security hardening, and container infrastructure.
Installation
ansible-galaxy collection install devxy.sysadmin
Usage
requirements.yml:
collections:
- name: devxy.sysadmin
version: <version>
Playbook example:
- name: Configure servers
hosts: all
become: true
roles:
- role: devxy.sysadmin.configure_rhel
vars:
configure_rhel_authorized_keys:
- user: admin
key: ssh-ed25519 AAAAC3... [email protected]
- role: devxy.sysadmin.docker
vars:
docker_cleanup_enabled: true
- role: devxy.sysadmin.certbot
vars:
certbot_admin_email: [email protected]
certbot_create_if_missing: true
certbot_deploy_hooks_reload:
- nginx
- role: devxy.sysadmin.node_exporter
- role: devxy.sysadmin.restic
vars:
restic_repos:
local:
location: /backup/restic
password: "secret"
init: true
restic_backups:
data:
name: data
repo: local
src: /data
scheduled: true
See examples/site.yml for a full-stack playbook applying all roles in the recommended order.
Roles
| Role | Description |
|---|---|
| configure_rhel | RHEL/AlmaLinux system configuration and security hardening |
| configure_debian | Debian/Ubuntu system configuration and security hardening |
| chrony | NTP time synchronization with chrony (EL/Debian/Ubuntu) |
| docker | Docker CE installation with IPv6 support and cleanup automation |
| certbot | Let's Encrypt certificate management with auto-renewal |
| nginx | nginx from nginx.org (or the OS) with raw, validated config files |
| node_exporter | Prometheus node_exporter for host metrics collection |
| restic | Restic backup automation with systemd timers and retention |
| journald | systemd-journald persistent storage and retention |
| postfix | Relay/null client to forward system mail to a smarthost |
| tuned | Apply a tuned system performance profile |
| overload_guard | HAProxy and kernel limits sized from the host, so no flood can stall it |
| banner | Pre-login warning banner and message of the day |
| aide | File integrity monitoring with AIDE (baseline + scheduled check) |
| kdump | Kernel crash dump (vmcore) capture |
| dnf_automatic | Automatic DNF security updates (RHEL/EL) |
| apt_automatic | Automatic APT security updates (Debian/Ubuntu) |
| systemd_notify_email | systemd OnFailure email handler (shared by certbot, restic, docker, apt_automatic, dnf_automatic) |
| nfs | NFS client mount management |
| users | User and group management with SSH key deployment |
Migration Notes
2.0 — systemd-only scheduling (BREAKING)
Cron-based scheduling has been removed from the certbot, restic, and docker roles.
Systemd is now required on managed hosts.
Removed variables:
| Role | Removed variable | Replacement |
|---|---|---|
| certbot | certbot_auto_renew_method |
systemd timer (always) |
| certbot | certbot_renewal_email |
systemd_notify_email_to |
| restic | restic_schedule_type |
systemd timer (always) |
| restic | restic_mail_on_error |
restic_failure_notify |
| restic | restic_mail_address |
systemd_notify_email_to |
| docker | docker_cleanup_cron_enabled |
docker_cleanup_enabled |
| docker | docker_image_refresh_cron |
docker_image_refresh_enabled |
| docker | docker_image_refresh_mailto |
systemd_notify_email_to |
Failure mail is now handled by the new systemd_notify_email role, which is auto-included when certbot_failure_notify, restic_failure_notify, or docker_failure_notify is true (all default true).
apt_automatic also routes failure mail through the same handler (default-on); dnf_automatic does so when dnf_automatic_failure_notify: true (opt-in, default-off).
Set the recipient address globally via systemd_notify_email_to (e.g. in group_vars).
A local MTA is required; the postfix role provides one.
Timer scheduling variables: certbot_oncalendar / certbot_randomizeddelaysec, restic_oncalendar / restic_randomizeddelaysec, docker_cleanup_oncalendar / docker_cleanup_randomizeddelaysec, docker_image_refresh_oncalendar / docker_image_refresh_randomizeddelaysec.
Testing
Roles are tested with Molecule using Docker containers.
# Setup virtual environment
just init-venv
# Test individual roles
just test-rhel
just test-docker
just test-certbot
just test-node-exporter
just test-restic
# Test all roles
just test-all
# Or use molecule directly
just molecule-test role=configure_rhel
just molecule-converge role=docker
just molecule-verify role=certbot
just molecule-destroy role=certbot
Test configuration:
- Image: AlmaLinux 9 via
cr.codefloe.com/docker.io/proxy cache - Certbot: Uses Let's Encrypt staging server (
certbot_testmode: true)
Development
# Lint
just lint
# Generate documentation
just ansible-doctor
# Build collection
just galaxy-build
# Publish to Galaxy
just galaxy-publish