refactor ♻️: Refactor README and update role for Proxmox VE provisioning
This refactoring includes updating the README, changing the role name to focus on Proxmox VE, enhancing compatibility matrix, and refactoring default values for role variables. Handlers are updated to manage apt cache, restart pveproxy, and reload systemd. Role metadata is also updated for better Proxmox VE provisioning.
This commit is contained in:
98
README.md
98
README.md
@@ -1,30 +1,42 @@
|
||||
# ansible-role-template
|
||||
# ansible_role_proxmox_provision
|
||||
|
||||
> A reusable Ansible role template for deploying and managing
|
||||
> applications/services with security best practices.
|
||||
> A reusable Ansible role template for for Proxmox VE
|
||||
> with a focus on provisioning and managing.
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://www.ansible.com/)
|
||||
[](https://www.debian.org/)
|
||||
[](https://www.proxmox.com/)
|
||||
|
||||
## 📌 Key Features
|
||||
|
||||
✅ **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
|
||||
✅ **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 | ✅ | ✅ | ✅ |
|
||||
|
||||
|
||||
## 📂 Directory Structure
|
||||
|
||||
```text
|
||||
ansible-role-template/
|
||||
ansible_role_proxmox_provision/
|
||||
├── README.md # This file
|
||||
├── defaults/ # Default role variables
|
||||
├── defaults/ # Default role variables (overridable)
|
||||
│ └── main.yml
|
||||
├── handlers/ # Role handlers
|
||||
├── handlers/ # Role handlers (for follow-up actions)
|
||||
│ └── main.yml
|
||||
├── files/ # Static files to deploy
|
||||
├── meta/ # Role metadata
|
||||
│ └── main.yml
|
||||
├── tasks/ # Main role tasks
|
||||
@@ -36,38 +48,38 @@ ansible-role-template/
|
||||
└── main.yml
|
||||
```
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Ansible 2.12+
|
||||
- Python 3.8+
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
## Default Variables (`defaults/main.yml`)
|
||||
|
||||
```yaml
|
||||
# Default values for role variables
|
||||
role_template_service_name: "default_service"
|
||||
role_template_service_port: 80
|
||||
role_template_backup_enabled: false
|
||||
role_template_service_backup_dir: "/var/backups/{{ role_template_service_name }}"
|
||||
role_template_monitoring_enabled: false
|
||||
## 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`)
|
||||
### Example Playbook (example-playbook.yml)
|
||||
|
||||
```yaml
|
||||
---
|
||||
- hosts: all
|
||||
- hosts: proxmox_hosts
|
||||
roles:
|
||||
- role: yourorg.ansible-role-template
|
||||
- role: ansible_role_proxmox_provision
|
||||
vars:
|
||||
role_template_service_name: "myapp"
|
||||
role_template_service_port: 8080
|
||||
proxmox_disable_swap: false
|
||||
proxmox_swapiness: 20
|
||||
proxmox_enable_powertop: true
|
||||
```
|
||||
|
||||
### 3. Run the Playbook
|
||||
@@ -76,6 +88,23 @@ role_template_monitoring_enabled: false
|
||||
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
|
||||
|
||||
1. Clone this repository or add as a dependency in your project:
|
||||
|
||||
```bash
|
||||
git clone https://server.com/user/ansible_role_proxmox_provision.git
|
||||
```
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License
|
||||
@@ -83,6 +112,9 @@ See the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## TODO
|
||||
|
||||
☐ refactor
|
||||
☐ debug
|
||||
☐ docs
|
||||
⏳ 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
|
||||
|
||||
Reference in New Issue
Block a user