2026-02-07 08:29:45 +01:00
|
|
|
|
# ansible_role_proxmox_provision
|
2026-02-07 07:22:24 +01:00
|
|
|
|
|
2026-02-07 08:29:45 +01:00
|
|
|
|
> A reusable Ansible role template for for Proxmox VE
|
|
|
|
|
|
> with a focus on provisioning and managing.
|
2026-02-07 07:22:24 +01:00
|
|
|
|
|
|
|
|
|
|
[](https://opensource.org/licenses/MIT)
|
|
|
|
|
|
[](https://www.ansible.com/)
|
2026-02-07 08:29:45 +01:00
|
|
|
|
[](https://www.proxmox.com/)
|
2026-02-07 07:22:24 +01:00
|
|
|
|
|
|
|
|
|
|
## 📌 Key Features
|
|
|
|
|
|
|
2026-02-07 08:29:45 +01:00
|
|
|
|
✅ **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 | VE 7 | VE 8 | VE 9 |
|
|
|
|
|
|
| ------------------------ | ---- | ---- | ---- |
|
|
|
|
|
|
| No-subscription repo | ✅ | ✅ | ✅ |
|
|
|
|
|
|
| Enterprise repo disabled | ✅ | ✅ | ✅ |
|
|
|
|
|
|
| Subscription nag removed | ✅ | ✅ | ✅ |
|
|
|
|
|
|
| Swap handling | ✅ | ✅ | ✅ |
|
|
|
|
|
|
| Logrotate protection | ✅ | ✅ | ✅ |
|
|
|
|
|
|
| Powertop auto-tune | ✅ | ✅ | ✅ |
|
|
|
|
|
|
|
2026-02-07 07:22:24 +01:00
|
|
|
|
|
|
|
|
|
|
## 📂 Directory Structure
|
|
|
|
|
|
|
|
|
|
|
|
```text
|
2026-02-07 08:29:45 +01:00
|
|
|
|
ansible_role_proxmox_provision/
|
2026-02-07 07:22:24 +01:00
|
|
|
|
├── README.md # This file
|
2026-02-07 08:29:45 +01:00
|
|
|
|
├── defaults/ # Default role variables (overridable)
|
2026-02-07 07:22:24 +01:00
|
|
|
|
│ └── main.yml
|
2026-02-07 08:29:45 +01:00
|
|
|
|
├── handlers/ # Role handlers (for follow-up actions)
|
2026-02-07 07:22:24 +01:00
|
|
|
|
│ └── main.yml
|
|
|
|
|
|
├── meta/ # Role metadata
|
|
|
|
|
|
│ └── main.yml
|
|
|
|
|
|
├── tasks/ # Main role tasks
|
2026-02-07 08:45:39 +01:00
|
|
|
|
│ ├── 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
|
2026-02-07 07:22:24 +01:00
|
|
|
|
├── templates/ # Jinja2 templates
|
|
|
|
|
|
└── vars/ # Non-overridable variables
|
|
|
|
|
|
└── main.yml
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 🔧 Configuration
|
|
|
|
|
|
|
|
|
|
|
|
## Default Variables (`defaults/main.yml`)
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
|
# Default values for role variables
|
2026-02-07 08:29:45 +01:00
|
|
|
|
## 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
|
2026-02-07 07:22:24 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Example usage
|
|
|
|
|
|
|
2026-02-07 08:29:45 +01:00
|
|
|
|
### Example Playbook (example-playbook.yml)
|
2026-02-07 07:22:24 +01:00
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
|
---
|
2026-02-07 08:29:45 +01:00
|
|
|
|
- hosts: proxmox_hosts
|
2026-02-07 07:22:24 +01:00
|
|
|
|
roles:
|
2026-02-07 08:29:45 +01:00
|
|
|
|
- role: ansible_role_proxmox_provision
|
2026-02-07 07:22:24 +01:00
|
|
|
|
vars:
|
2026-02-07 08:29:45 +01:00
|
|
|
|
proxmox_disable_swap: false
|
|
|
|
|
|
proxmox_swapiness: 20
|
|
|
|
|
|
proxmox_enable_powertop: true
|
2026-02-07 07:22:24 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 3. Run the Playbook
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
ansible-playbook -i inventory.ini example-playbook.yml
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-07 08:29:45 +01:00
|
|
|
|
## 🚀 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
|
|
|
|
|
|
|
|
|
|
|
|
1. Clone this repository or add as a dependency in your project:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git clone https://server.com/user/ansible_role_proxmox_provision.git
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-07 07:22:24 +01:00
|
|
|
|
## 📄 License
|
|
|
|
|
|
|
|
|
|
|
|
This project is licensed under the MIT License
|
|
|
|
|
|
See the [LICENSE](LICENSE) file for details.
|
|
|
|
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
|
|
2026-02-07 08:29:45 +01:00
|
|
|
|
⏳ Make the nag patch checksum-based (auto-repatch after upgrades)
|
|
|
|
|
|
❌ Add kernel power-saving tunables ?
|
|
|
|
|
|
🔄 Split into VE version–aware tags ?
|
|
|
|
|
|
🕒 refactor
|
|
|
|
|
|
✗ debug
|
|
|
|
|
|
⭐ Improve documentation
|