devxy/ansible-sysadmin
Watch
0
2
Fork
You've already forked ansible-sysadmin
1
Roles related to Linux system administration
  • Jinja 94.1%
  • Just 5.8%
  • JavaScript 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-30 09:48:43 +00:00
.crow chore(deps): update crow and docker-compose (major) (#88) 2026-11-30 07:15:28 +00:00
.gitsv init collection 2026-01-14 20:18:15 +01:00
ansibledoctor/templates/readme feat(watchdog): pick the chipset driver from the CPU vendor (#70) 2026-08-01 09:37:53 +00:00
examples feat: systemd-only scheduling with shared OnFailure failure mail (#59) 2026-06-10 11:48:00 +00:00
meta init collection 2026-01-14 20:18:15 +01:00
roles feat(configure_rhel): add extra logrotate directives for the shared syslog stanza (#90) 2026-11-30 09:34:58 +00:00
.ansible-lint ci(lint): run ansible-lint and yamllint, enforce production profile (#30) 2026-06-05 15:18:21 +00:00
.ansibledoctor.yaml init collection 2026-01-14 20:18:15 +01:00
.editorconfig init collection 2026-01-14 20:18:15 +01:00
.editorconfig-checker.json init collection 2026-01-14 20:18:15 +01:00
.gitignore feat(nginx): add an nginx role with nginx.org packages and validated raw config (#83) 2026-11-19 09:34:34 +00:00
.markdownlint-cli2.yaml init collection 2026-01-14 20:18:15 +01:00
.markdownlint.yaml init collection 2026-01-14 20:18:15 +01:00
.pre-commit-config.yaml chore(deps): update pre-commit hook davidanson/markdownlint-cli2 to v0.24.2 2026-11-28 00:02:41 +00:00
.yamllint.yaml init collection 2026-01-14 20:18:15 +01:00
commitlint.config.mjs init collection 2026-01-14 20:18:15 +01:00
galaxy.yml [skip ci] Update galaxy.yml after release 2026-11-30 09:48:43 +00:00
Justfile feat(nginx): add an nginx role with nginx.org packages and validated raw config (#83) 2026-11-19 09:34:34 +00:00
README.md feat(overload_guard): add a role sizing HAProxy and kernel limits from the host (#85) 2026-11-22 20:45:28 +00:00
renovate.json ci(renovate): track ansible-lint and yamllint pinned in crow pip installs (#89) 2026-11-30 09:30:43 +00:00

Ansible Collection "sysadmin"

status-badge

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.

Ansible Galaxy

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