Skip to content

sbarbett/proxmox-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

proxmox_management

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.

Overview

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.

Requirements

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.

Quick Start

  1. Set up your environment: Use the bootstrap.yml playbook in examples/ to install the required dependencies:

    python3 -m venv venv
    source venv/bin/activate
    pip install ansible
    ansible-playbook examples/bootstrap.yml
  2. Install the collection:

    ansible-galaxy collection install sbarbett.proxmox_management
  3. Configure your vault and container definitions in group_vars/.

Usage

You can integrate this collection into your playbooks for a complete workflow. Here are some useful examples:

Docker Compose Templates

This collection includes ready-to-use Docker Compose manifests for some common services:

License

MIT