This Ansible collection makes it easy to provision, configure, and manage Proxmox LXC containers. It includes several roles that handle everything from setting up containers to applying advanced configurations and even deploying Docker containers inside them.
The collection is composed of the following roles:
- proxmox_provision – Creates and starts LXC containers on a Proxmox host using the Proxmox API.
- container_inventory – Retrieves container IP addresses using a Python script and automatically adds them to the Ansible inventory.
- container_setup – Handles basic setup, like updating packages, creating non-root users, and disabling root login.
- container_extras – Runs additional non-root setup tasks, such as installing extra packages and customizing system messages.
- docker_compose – Deploys and manages Docker containers on LXC hosts using Docker Compose.
These roles are designed to work together, starting with container creation and ending with full application deployment via Docker.
To use this collection, you'll need:
- Ansible: Version 2.9 or later.
- Python Libraries (on the control node):
- proxmoxer
- requests
- passlib
- Ansible Collection Dependency: community.general (>=6.0.0)
- Proxmox API Access: Valid credentials and network access to your Proxmox server.
Note: I recommend using geerlingguy.docker
to install Docker and its dependencies.
-
Set up your environment: Use the
bootstrap.yml
playbook inexamples/
to install the required dependencies:python3 -m venv venv source venv/bin/activate pip install ansible ansible-playbook examples/bootstrap.yml
-
Install the collection:
ansible-galaxy collection install sbarbett.proxmox_management
-
Configure your vault and container definitions in
group_vars/
.
You can integrate this collection into your playbooks for a complete workflow. Here are some useful examples:
- Example playbook: Full LXC workflow - From provisioning to final setup.
- Example LXC dictionary - Defines your containers.
This collection includes ready-to-use Docker Compose manifests for some common services:
- IT Tools (Environment file)- A collection of useful utilities for IT professionals.
- Gitea (Environment file) - A lightweight, self-hosted Git service.
- PiHole-Unbound (Environment file) - A PiHole 6 container preconfigured with Unbound for upstream recursion.
MIT