38831f981add00b3035e77581b177d686ce6fb48
All checks were successful
ansible-lint / Ansible Lint (push) Successful in 12s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 11s
PR check / Gitleaks (pull_request) Successful in 4s
PR check / lint tests (pull_request) Successful in 15s
PR check / labeler (pull_request) Successful in 2s
PR check / handle_failures (pull_request) Has been skipped
PR check / handle_success (pull_request) Successful in 2s
Refactored the code to include a conditional check for the existence of the firewall file before proceeding with debugging. This ensures that the debugging process is only initiated when necessary, preventing unnecessary operations and potential errors.
README ansible_role_proxmox_provision
A reusable Ansible role template for for Proxmox VE with a focus on provisioning and managing.
📌 Features
✅ Proxmox VE Optimized - Specifically designed for Proxmox Virtual Environment ⬜ Idempotent - Safe to run multiple times ⏳ Security Hardened - Follows Ansible security best practices ⏳ Modular - Clear separation of concerns ⏳ Documented - Comprehensive README and variable documentation ⏳ Tested - Includes example playbook for validation
📊 Compatibility Matrix
| Feature \ Proxmox Version | 7 | 8 | 9 |
|---|---|---|---|
| No-subscription repo | ✅ | ✅ | ✅ |
| Enterprise repo disabled | ✅ | ✅ | ✅ |
| Subscription nag removed | ✅ | ✅ | ✅ |
| Swap handling | ✅ | ✅ | ✅ |
| Logrotate protection | ✅ | ✅ | ✅ |
| Powertop auto-tune | ✅ | ✅ | ✅ |
| Utilities | ✅ | ✅ | ✅ |
| Fail2Ban Integration | ✅ | ✅ | ✅ |
📂 Directory Structure
ansible_role_proxmox_provision/
├── README.md # This file
├── defaults/ # Default role variables (overridable)
│ └── main.yml
├── handlers/ # Role handlers (for follow-up actions)
│ └── main.yml
├── meta/ # Role metadata
│ └── main.yml
├── tasks/ # Main role tasks
│ ├── fail2ban.yml # Fail2Ban integration tasks
│ ├── logrotate.yml # logrotate setup
│ ├── main.yml # Core tasks
│ ├── powertop.yml # powertop setup
│ ├── repos.yml # Repository setup
│ ├── subscription.yml # Subscription nag removal
│ ├── swap.yml # Swap setup
│ └── utilities.yml # Utilities installation
├── templates/ # Jinja2 templates
└── vars/ # Non-overridable variables
└── main.yml
🔧 Configuration
Default Variables (defaults/main.yml)
# Default values for role variables
## Swap handling
proxmox_disable_swap: true
proxmox_swapiness: 10
proxmox_min_ram_mb_for_no_swap: 16384
## Powertop
proxmox_enable_powertop: true
## Logrotate
proxmox_logrotate_maxsize: "100M"
proxmox_logrotate_rotate: 7
...
Example usage
Example Playbook (example-playbook.yml)
---
- hosts: proxmox_hosts
roles:
- role: ansible_role_proxmox_provision
vars:
proxmox_disable_swap: false
proxmox_swapiness: 20
proxmox_enable_powertop: true
3. Run the Playbook
ansible-playbook -i inventory.ini example-playbook.yml
🚀 Installation and Setup
Prerequisites
- Ansible 2.12 or higher
- Python 3.8 or higher
- Proxmox VE 7.x or higher
- Root/sudo access to Proxmox hosts
Installation
- Clone this repository or add as a dependency in your project:
git clone https://server.com/user/ansible_role_proxmox_provision.git
📄 License
This project is licensed under the MIT License
See the LICENSE file for details.
TODO
⏳ add molecule tests to prove idempotency
⏳ make the patch handler trigger on pve-manager upgrades
🔄 Split into VE version–aware tags ?
🕒 refactor
✗ debug
⭐ Improve documentation
Languages
Jinja
50.4%
Shell
49.6%