Proxmox Ansible Playbook: Automate Your Proxmox Setup and Management! (Beta Version)
Hi everyone!
I’m excited to share the first BETA version of my Ansible playbook, designed to automate the configuration, optimization, and management of Proxmox VE.
The idea to create this playbook came from my own experience — I couldn’t find a good tool online for provisioning Proxmox hosts that met my needs. So, I decided to build my own solution from scratch. I hope this tool will save you time and effort when working with Proxmox!
Please note that this is a work in progress, and I’ve been developing it solo. It may still need refinements and improvements, and I’d greatly appreciate any feedback or suggestions from the community.
Vars example on GitHub
cd proxmox-ansible
cp hosts_vars/example.yml hosts_vars/<your_host_name>.yml
Edit your_host_name.yml to match your desired configuration.
initial_password: P@ssw0rd* # The initial user's password.
Create a pub_keys folder:
These keys will automatically be added to the user specified in the system_user variable.
all:
hosts:
proxmox-host:
ansible_host: <your_proxmox_ip>
vars_files:
- hosts_vars/<your_host_name>.yml
docker build -t proxmox:latest .
Run the Docker Container:
docker run -it --name proxmox -v $PWD/:/opt proxmox:latest
This will create and start a Docker container with Ansible pre-installed, allowing you to run the playbook directly from the container.
Thanks for checking it out, and I hope it helps streamline your Proxmox management!
Hi everyone!
I’m excited to share the first BETA version of my Ansible playbook, designed to automate the configuration, optimization, and management of Proxmox VE.
The idea to create this playbook came from my own experience — I couldn’t find a good tool online for provisioning Proxmox hosts that met my needs. So, I decided to build my own solution from scratch. I hope this tool will save you time and effort when working with Proxmox!
Please note that this is a work in progress, and I’ve been developing it solo. It may still need refinements and improvements, and I’d greatly appreciate any feedback or suggestions from the community.
Key Features:
- General System Settings: Automatically configure backups, reboots, and system updates.
- Network Configuration: Set up static IPs, bridges, and DNS servers with ease.
- User Management: Add users, set passwords, and manage SSH keys automatically.
- Performance Optimization: Fine-tune CPU scaling governors, enable nested virtualization, and manage ZFS ARC.
- Service Management: Enable or disable services like AppArmor, Fail2Ban, and Nginx.
- Kernel Management: Pin/unpin kernels or install specific kernel versions.
- Custom ISO Management: Automate the download of Windows VirtIO drivers or custom ISO images.
- RAM Disk for Logs: Move logs to a RAM disk for better performance and cleaner storage.
Compatibility:
- Proxmox VE Versions: Tested on 7.x and 8.x.
- Boot Modes: Works with both GRUB and UEFI configurations.
GitHub Repository:
Check out on GitHubVars example on GitHub
How to Use:
Clone the repository:
git clone git@github.com:yokozu777/proxmox-ansible.gitcd proxmox-ansible
Configure variables for your hosts:
Copy and customize the example variables file:cp hosts_vars/example.yml hosts_vars/<your_host_name>.yml
Edit your_host_name.yml to match your desired configuration.
Required Variables for Connection
To ensure a successful connection, make sure to fill in the following variables in your host vars file:Users Configuration
initial_user: root # The initial user for the system.initial_password: P@ssw0rd* # The initial user's password.
Using SSH Keys for Authentication
If you prefer to use SSH keys for authentication, follow these steps:Create a pub_keys folder:
- In the same directory as your host vars file, create a folder named pub_keys.
- Place your public SSH keys (.pub files) in the pub_keys folder.
These keys will automatically be added to the user specified in the system_user variable.
Example:
system_user: localuser # The user to which the public keys will be addedAdd your hosts to the inventory:
Update inventory.yml with your host(s) and link to the variables file:all:
hosts:
proxmox-host:
ansible_host: <your_proxmox_ip>
vars_files:
- hosts_vars/<your_host_name>.yml
Quick Start with Docker
If you do not have Ansible installed, but Docker is available, you can use the provided Dockerfile for a quick setup.Steps to Use Docker:
Build the Docker Image:docker build -t proxmox:latest .
Run the Docker Container:
docker run -it --name proxmox -v $PWD/:/opt proxmox:latest
This will create and start a Docker container with Ansible pre-installed, allowing you to run the playbook directly from the container.
Run the playbook:
ansible-playbook proxmox.ymlFeedback and Contributions:
This playbook was born out of the lack of tools for provisioning Proxmox hosts I could find online. If you have any feedback, suggestions, or ideas to improve it, I’d be incredibly grateful to hear them! Contributions are also welcome if you’d like to collaborate on making this tool even better.Thanks for checking it out, and I hope it helps streamline your Proxmox management!
Last edited: