This repository provides a simple, repeatable way to bootstrap new Ubuntu or Debian virtual machines using Ansible.
The goal is to eliminate manual “first 10 minutes” setup work by standardizing:
- SNMP configuration (LibreNMS-compatible)
- Checkmk agent installation
- NFS mounts
- Hostname resolution for NAS access
Once set up, onboarding a new VM is a single command.
For each target VM, the bootstrap playbook:
- Ensures
nasresolves to a fixed IP via/etc/hosts - Installs baseline packages:
snmpdnfs-commongit
- Deploys a known-good
snmpd.conf - Installs the LibreNMS
distrohelper script for SNMP - Installs the LibreNMS / Checkmk agent:
- Clones the LibreNMS agent repo to
/opt/librenms-agent - Installs
check_mk_agentto/usr/bin - Installs and enables the
check_mk.socketsystemd unit
- Clones the LibreNMS agent repo to
- Creates and mounts a standard NFS mount:
nas:/pool→/vol1- Safe boot options (
_netdev,nofail,x-systemd.automount)
All steps are idempotent and safe to re-run.
vm-bootstrap/
├── bootstrap.yml # Main Ansible playbook
├── enroll # Convenience script to enroll a new VM
├── inventory.ini # Optional static inventory
├── files/
│ └── snmpd.conf # SNMP configuration deployed to target hosts
└── README.md
- macOS
- Homebrew
- Ansible
Install Ansible:
brew install ansibleVerify:
ansible --version- Ubuntu or Debian
- SSH access
- A user with sudo privileges
- SSH key-based authentication recommended
- Clone or copy this repository to your laptop:
git clone <this-repo>
cd vm-bootstrap- Place your
snmpd.confin:
files/snmpd.conf- Ensure the
enrollscript is executable:
chmod +x enroll./enroll <ip> <user>Example:
./enroll 192.168.1.38 zingerThis will:
- Verify SSH connectivity
- Run the Ansible bootstrap playbook
If run with no arguments, the script prints usage instructions.
Edit inventory.ini:
[newvms]
192.168.1.38 ansible_user=zingerRun manually:
ansible-playbook -i inventory.ini bootstrap.yml --ask-become-passCommon variables are defined near the top of bootstrap.yml:
nas_ip: "192.168.1.250"
nas_host: "nas"
nfs_src: "nas:/pool"
nfs_path: "/vol1"Adjust these if your environment changes.
- The playbook is hypervisor-agnostic (KVM, Proxmox, etc.)
- Safe to re-run at any time to converge systems to the desired state
- Designed for small homelab and infrastructure environments
- Passwordless sudo in VM templates
- Cloud-init integration
- Conversion to Ansible roles
- Automatic enrollment via Proxmox or libvirt hooks
Internal / personal use. Modify freely.