Compare commits

128 Commits
dev ... main

Author SHA1 Message Date
f6c9c70fcd fix 🐛: Remove secrets.yml and task comment
This commit removes the inclusion of the `secrets.yml` variables file and comments out the associated task. This simplifies the project setup and addresses potential security concerns related to storing sensitive information in the codebase. The task is now commented out, effectively disabling it without removing the code.
2025-12-14 10:03:00 +01:00
066a599d9b fix 🐛: Update admin password
This commit updates the admin password within the `testvault.yml` file to improve security.  The change ensures that unauthorized access to the test vault is prevented.  This aligns with best practices for securing sensitive configuration files.
2025-12-14 09:58:37 +01:00
8f25ef2a14 fix 🐛: Update testvault.yml
This commit updates the `testvault.yml` file to include the `admin_user` variable, addressing a missing configuration element.  Additionally, the debug message has been refined for improved clarity and troubleshooting. This ensures proper test execution and provides more informative feedback.
2025-12-14 09:57:42 +01:00
a4b6ecd9f1 fix 🐛: Include and debug secrets
This commit addresses the need to incorporate secrets from the `secrets.yml` file into the application. It includes the necessary steps for debugging and resolving any potential issues related to secret management. This ensures secure access to sensitive information during development and testing.
2025-12-14 09:48:05 +01:00
c4d6dd8f4b fix 🐛: Remove commented credentials
This commit removes commented-out Proxmox credentials variables from the testing.yml file. This resolves an issue where these variables were present, potentially exposing sensitive information during testing. The removal ensures a cleaner and more secure testing environment.
2025-12-14 07:16:08 +01:00
914d6de8b6 fix 🐛: Update Proxmox credentials
This commit updates the Proxmox credentials within the testing task file.  This ensures the testing environment can successfully authenticate with Proxmox, resolving potential connection issues.  The change improves the reliability of automated testing.
2025-12-14 07:14:16 +01:00
aa8b2375db fix 🐛: Remove Proxmox credentials comments
This commit removes commented-out variable definitions related to Proxmox credentials. These were identified as unnecessary and potentially confusing, improving code readability and reducing clutter. The removal ensures a cleaner and more focused codebase.
2025-12-14 07:05:58 +01:00
5288b88fcd fix 🐛: Update VM IP address
This commit updates the virtual machine's IP address to 192.168.2.3/24, resolving an issue with network connectivity during testing.  This change ensures proper network access for the testing environment.  The change was made to align with the latest network configuration.
2025-12-14 06:56:35 +01:00
ce8d5a7811 feat : Update playbook source and add role
This commit updates the playbook's source to utilize ansible-playbook-homelab and incorporates the ansible-role-debian_common role. The changes include updating VM names and adding a new task for deploying the Debian common role, streamlining the automation process.
2025-12-14 06:54:40 +01:00
f954fd25b3 fix 🐛: Adjust VM memory for 'dc' template
This commit updates the VM memory allocation specifically for the 'dc' template, resolving an issue where memory was misconfigured. It also removes the outdated 'vm-01' entry, streamlining the configuration and ensuring optimal performance.
2025-12-12 20:15:39 +01:00
8289e73119 chore 📦: Setup PVE-mods dependencies
This commit sets up the necessary environment for PVE-mods, including installing required packages and cloning the project repository. This ensures a clean and functional setup for further development or modification of the PVE-mods project. The changes focus on the build process and dependencies.
2025-12-11 21:10:06 +01:00
fe78fd6fe7 fix 🐛: Reduce VM disk sizes
This commit updates the Debian and Ubuntu VM templates to utilize smaller disk sizes, optimizing storage space. The changes also incorporate updated configurations for improved performance and compatibility. These adjustments streamline the VM deployment process and enhance overall system efficiency.
2025-12-11 21:09:38 +01:00
0a18c43555 fix 🐛: Update Debian image URLs
This commit updates the URLs for Debian images used as Proxmox templates. The URLs have been corrected to reflect the latest available Debian 13 images, ensuring proper template downloads and configurations within the Proxmox environment.
2025-12-10 21:03:36 +01:00
88290aaad9 docs 📝: Update documentation for VM configuration
This commit updates the documentation to reflect the changes in VM configuration, specifically regarding the `vlan` setting.  It clarifies the intended usage and potential values for this parameter. This ensures consistency and reduces potential confusion for users.
2025-12-10 19:05:48 +01:00
1472f0a2b9 fix 🐛: Update Debian OS type
Corrected the OS type for the proxmox_template_vm_debian_ostype to 'l26' to align with the latest configuration. This ensures consistency and accuracy in the template definitions. The change resolves a potential mismatch between the template and the actual operating system.
2025-12-10 18:58:20 +01:00
06ee6875e8 docs 📝: Update documentation for Debian template configurations.
This commit updates the documentation to reflect the new configurations for Debian templates, including supported distros, image URLs, and associated settings like storage, memory, cores, and SSH keys. This ensures clarity for users setting up Debian-based templates within Proxmox.
2025-12-10 18:53:55 +01:00
35424875c1 fix 🐛: Update DNS nameservers
This commit updates the DNS nameservers for two virtual machine templates (vm-01 and vm-02) to 8.8.8.8, resolving potential DNS resolution issues. This change improves network connectivity for the VMs.
2025-12-10 17:45:32 +01:00
c095c92eeb fix 🐛: Update ubuntu storage to local-lvm
This commit changes the default storage type for Ubuntu templates from 'local' to 'local-lvm'. This adjustment aligns with best practices for Ubuntu template deployments, providing a more robust and isolated storage environment for the virtual machine images.
2025-12-10 17:35:00 +01:00
d1c6c2bc99 fix 🐛: Update Ubuntu storage template
The Ubuntu template's default storage has been changed from 'hdd8t' to 'local' to align with current best practices and simplify deployment. This change ensures the template utilizes local storage, reducing potential configuration complexities. This update improves the overall usability and consistency of the template.
2025-12-10 17:33:01 +01:00
14057130e6 fix 🐛: Update VM templates
This commit updates the VM templates used during the creation process. Specifically, the 'vm-01' template is changed from 5000 to 9412, and 'vm-02' from 5500 to 9413. These changes likely reflect updated base images or configurations for the virtual machines.
2025-12-09 20:51:26 +01:00
e3414af675 style 💎: Remove commented-out sshkeys config
This commit removes a commented-out configuration section for `sshkeys` within the testing task definition. This was likely a temporary setting and is now permanently removed, simplifying the configuration and preventing potential issues.
2025-12-09 20:50:23 +01:00
5936ff6ff4 chore 📦: Update snippets storage config
This commit updates the configuration for the snippets storage, setting it to 'local'. This change ensures that snippets are stored locally, simplifying the deployment process and improving performance. The configuration update is part of a broader effort to streamline the preflight process.
2025-12-09 20:46:23 +01:00
6ef534f8d8 refactor ♻️: Preflight: Snippets configuration check
This commit refactors the preflight task to intelligently check if the 'snippets' configuration is already present in the `/etc/pve/storage.cfg` file.  It avoids redundant replacement operations and improves the preflight process by determining if the configuration is already set, preventing unnecessary modifications.
2025-12-09 20:41:44 +01:00
5faba468f7 fix 🐛: Enable snippets storage
This commit updates the PVE storage configuration to ensure the 'snippets' storage is properly enabled. It modifies the `/etc/pve/storage.cfg` file to include the 'snippets' option, resolving potential issues with snippet functionality. The IP address of the network interface has also been updated.
2025-12-09 19:33:22 +01:00
ccb9fc760c fix 🐛: Ensure snippets storage is enabled
This commit updates the `tasks/testing.yml` file to correctly enable the 'snippets' storage for Proxmox. The change ensures that the snippets storage directory is properly configured, resolving an issue where snippets were not being utilized. This update improves the Proxmox setup process and ensures snippets functionality.
2025-12-09 19:28:06 +01:00
fdc28ae4a6 fix 🐛: Ensure snippets storage is enabled
This commit updates the preflight task to correctly enable the 'snippets' storage in /etc/pve/storage.cfg. The change uses a more robust regular expression to handle potential variations in the storage configuration, ensuring the snippets feature is properly activated.
2025-12-09 19:26:38 +01:00
8b6e0a5f59 chore 📦: Update VM deployment configuration
This commit updates the Ansible role for deploying VMs, defining two new VMs with specific configurations including IP addresses, VLAN assignments, and storage options. The changes also incorporate SSH key management from a file.
2025-12-09 19:11:16 +01:00
19b568c2b8 fix 🐛: Enable snippets in storage.cfg
This commit enables the 'snippets' feature in the Proxmox storage configuration file. It achieves this by adding a snippet line to the storage.cfg, ensuring that Proxmox snippets are available.  Additionally, it creates the necessary 'snippets' directory within the specified storage path.
2025-12-08 10:43:15 +01:00
c33a1e730b fix 🐛: Update SSH key variable references to join public keys with newline in testing.yml 2025-12-08 10:16:02 +01:00
b70c32993d feat : Add task to install proxmoxer package via APT in testing.yml 2025-12-08 09:29:00 +01:00
8c8f4ff417 feat : Update SSH key variable references for Ubuntu and Fedora templates in testing.yml 2025-12-08 09:24:22 +01:00
a4597def5d fix 🐛: Correct repository URL for ansible_proxmox_vm in requirements.yml 2025-12-08 08:24:35 +01:00
cc09f270ff feat : Add deployment tasks for Proxmox VM templates with customizable options 2025-12-08 08:16:22 +01:00
8f062cca53 feat : Update requirements.yml to include additional Ansible collections 2025-12-08 07:31:11 +01:00
8527a4a4ad feat : Add additional Ansible collections to requirements.yml 2025-12-07 22:19:02 +01:00
c93f2d8ea0 feat : Add Proxmox VM role to requirements and create Debian template task 2025-12-01 19:21:00 +01:00
2928061772 refactor ♻️: Simplified container configuration and added LXC ID to template
Refactored the setupacdc.yml file to use LXC IDs instead of container IDs, simplifying the configuration process. Also updated the create_lxc_container task to use the new LXC ID format.
2025-11-09 08:35:17 +01:00
e218a1705d style 💎: Update qcow2 disk path in Proxmox template
Updated the disk path from qcow2 to qemu in the create_proxmox_debian_template.yml file. This change ensures compatibility with newer Proxmox versions.
2025-11-09 06:44:23 +01:00
d5bc7f7ea9 commit undefined: Shrink compressed qcow2 using virt-sparsify
Updated the `create_proxmox_debian_template.yml` playbook to shrink the compressed qcow2 image using virt-sparsify, replacing the original shell command. This change improves efficiency and reduces storage requirements for Proxmox VM templates.
2025-11-09 06:36:07 +01:00
adb89dc4e8 refactor ♻️: Improve file transfer from LXC container to host using pct pull
Updated the 'copy' block to use pct pull instead of pct exec and rsync, simplifying the process and reducing unnecessary commands. This change improves the efficiency and readability of the template.
2025-11-09 06:27:42 +01:00
a64aa8d848 style 💎: Update file copy commands in Proxmox Debian template
Updated the commands for copying files from the LXC container to the host, ensuring consistency and accuracy in the template. The changes also improve readability and maintainability of the template.
2025-11-08 23:23:58 +01:00
ce7291bf3c refactor ♻️: Simplify copy file from LXC container to host using pct exec
Replaced multiple commands with a single pct exec command for copying files between the LXC container and the host, improving code readability and maintainability.
2025-11-08 23:18:02 +01:00
77a5f6276a feat : Add Debian template to Proxmox VM creation task
Added a new variable to the create_proxmox_debian_template.yml file to include the Debian template, allowing for more customization in the Proxmox VM creation process.
2025-11-08 23:03:01 +01:00
cc203b3c0b style 💎: Simplify shell commands in create_proxmox_debian_template.yml
Updated shell commands to use double quotes for command arguments, improving readability and consistency.
2025-11-08 22:57:30 +01:00
4fdef98933 style 💎: Update template variables for Proxmox Debian setup
Updated the `create_proxmox_debian_template.yml` file to remove unnecessary variables and improve code readability. The changes include updating the `lxc_password` and `lxc_id` variables, making it easier to manage container IDs.
2025-11-08 22:50:56 +01:00
4cc4ad48dc refactor ♻️: Improve LXC container file management in Proxmox template
Refactored the Proxmox template to use pct commands for mounting and unmounting the LXC container filesystem, simplifying the process of copying files between containers and the host. This change improves the overall efficiency and reliability of the template.
2025-11-08 22:43:40 +01:00
aaf121cd37 style 💎: Update rsync command for LXC container to Proxmox host
Updated the rsync command to use lxc-attach -n instead of just --rsh. This change ensures that the correct SSH connection is established when copying files from the LXC container to the Proxmox host.
2025-11-08 22:27:04 +01:00
18926c0047 feat : Add new task to create Proxmox Debian template
A new task was added to the existing script to import a Debian Cloud image as a Proxmox VM template, allowing for easier deployment of Debian-based systems on Proxmox servers.
2025-11-08 22:17:59 +01:00
b4817e7706 refactor ♻️: Update LXC build container and Debian cloud image template
Refactored the tasks to improve readability, added comments for better understanding, and updated variables with new values.
2025-11-08 22:06:59 +01:00
0c60000812 refactor ♻️: Improve template copy process for better performance
Updated the Ansible task to use rsync for copying templates between LXC containers and Proxmox hosts, reducing the need for qemu-img commands. This change also includes a warning flag to prevent potential issues with lxc-attach command.
2025-11-08 21:45:54 +01:00
cb32af2ad4 style 💎: Update template synchronization mode to push
Updated the Ansible synchronize task to use a push mode instead of pull, which will ensure that the latest template is deployed on each node.
2025-11-08 21:34:16 +01:00
ffbcb2b04f style 💎: Update template to remove unnecessary delegate_to option
Updated the create_proxmox_debian_template.yml file to remove the delegate_to option, as it is no longer required. This change improves the template's simplicity and consistency.
2025-11-08 21:25:31 +01:00
c9bf893582 feat : Create Proxmox Debian template with QEMU directory
Added a new task to create the QEMU template directory on the Proxmox host, ensuring it exists and has the correct permissions. This change enables the use of the QEMU template for creating Proxmox VMs.
2025-11-08 21:20:53 +01:00
b391cd6df9 style 💎: Update rsync mode and delegate to node0
Changed the rsync mode from push to pull, and added a delegate_to parameter to specify the target node for the rsync operation.
2025-11-08 21:18:30 +01:00
2ccfc0feb2 style 💎: Update rsync opts for correct path
Updated rsync options to use the correct rsync path. This change ensures that the rsync command is executed correctly when synchronizing files.
2025-11-08 20:26:37 +01:00
1b669f701c style 💎: Update Proxmox template path
Updated the destination path for the Proxmox template to '/var/lib/vz/template/iso/' from '/var/lib/vz/template/qcow2/'. This change ensures consistency with the expected location of the ISO file.
2025-11-08 20:14:47 +01:00
c2328a22e0 style 💎: Update rsync opts for proxmox template
Updated rsync options to use the correct path for proxmox templates, ensuring proper synchronization of files.
2025-11-08 19:58:18 +01:00
c89e916351 feat : Add Proxmox Debian template with sudo installation
Added a new task to the create_proxmox_debian_template.yml file to ensure sudo is installed during the template creation process. This change allows for more secure access to the system.
2025-11-08 19:52:35 +01:00
3b512c558b style 💎: Update synchronize command to use posix module
Updated the synchronize command in the Proxmox template task to use the ansible.posix.synchronize module, which is more compatible with Proxmox's file system. This change ensures that the template can be successfully synchronized on the target host.
2025-11-08 19:24:47 +01:00
f3a2e0ad0a style 💎: Update template sync mode to pull
Updated the Ansible synchronize task in the Proxmox Debian template to use a pull mode instead of push, which is more idiomatic for synchronizing files from the host to the container.
2025-11-08 18:52:34 +01:00
3c4b4a749d style 💎: Update rsync opts for sudo rsync path
Updated rsync options to include the sudo rsync path, ensuring secure file transfer. This change aligns with best practices for secure file management in Proxmox environments.
2025-11-08 18:01:42 +01:00
9fea674cae style 💎: Update shell commands to use template variables
Updated shell commands in the create_proxmox_debian_template.yml file to use template variables for consistency and reusability. This change allows for easier management of different templates without modifying the underlying command structure.
2025-11-08 17:47:44 +01:00
01331e6c80 style 💎: Update rsync options for proxmox template sync
Updated the rsync options to use 'push' instead of 'pull', ensuring proper synchronization of the template with Proxmox. This change improves the consistency and reliability of the template deployment process.
2025-11-08 17:39:40 +01:00
a69fdb50b0 style 💎: Simplify compressed image replacement
Updated the compressed image replacement step to remove unnecessary comments and shell commands. This change improves code readability and maintainability.
2025-11-08 17:36:49 +01:00
710c76d72b style 💎: Improve template creation process by adding QCOW2 image info and details
Added shell commands to display QCOW2 image information and details, making the template creation process more informative and user-friendly. This change improves the overall experience for users creating Proxmox Debian templates.
2025-11-08 17:34:23 +01:00
b87dca99bd style 💎: Improve template formatting and remove unused parameter
Updated the create_proxmox_debian_template.yml file to improve its readability by removing an unused parameter and adjusting indentation. This change enhances the overall code style without affecting its functionality.
2025-11-08 17:04:50 +01:00
7788d25612 style 💎: Update storage settings in proxmox template
Updated the `lxc_storage` variable from `hdd8t` to `local-lvm`, and added additional storage options (`--swap` and `--rootfs-size`) for more efficient resource allocation.
2025-11-08 16:59:29 +01:00
e42875a45d style 💎: Update image compression and shrinking steps
Updated the Ansible playbook to use virt-sparsify for compressing and shrinking images, replacing a previous qemu-img command. This change improves efficiency and reduces storage requirements.
2025-11-08 09:38:28 +01:00
06a73174e0 feat : Added container ID to Proxmox Debian template
Updated the create_proxmox_debian_template.yml file to include a new key for storing the container ID, which will be used in conjunction with the lxc_id variable.
2025-11-08 09:18:24 +01:00
1c6e71ccc3 feat : Add proxmox Debian template to create a new LXC build container
Updated the tasks/create_proxmox_debian_template.yml file to include a new parameter for combining SSH public keys into one file, allowing for easier management of multiple keys. This change enables more flexibility when creating LXC containers with Proxmox and Debian.
2025-11-08 09:14:57 +01:00
93b886c634 style 💎: Update template with new password field
Added a new parameter to the create_proxmox_debian_template.yml file to allow for a custom password when creating a Proxmox LXC instance. This change improves flexibility and security when deploying Debian-based images.
2025-11-08 09:10:28 +01:00
b0318b073a refactor ♻️: Improve wait for LXC container boot and IP assignment
Enhanced the wait logic for LXC container boot and IP assignment by adding a check for container status and handling different scenarios. This change improves the reliability of the script.
2025-11-08 09:05:36 +01:00
d855be2c80 feat : Add Proxmox LXC IP parsing with Ansible utils
Updated the 'wait for LXC to boot and get IP' task to use Ansible's ipaddr module for more accurate IP parsing, ensuring consistent results across different environments.
2025-11-08 09:02:30 +01:00
4561a64edb style 💎: Improve storage configuration in proxmox template
Updated the `--rootfs` option to use only `--storage` for more flexibility and readability. This change simplifies the configuration and makes it easier to manage different storage options.
2025-11-08 08:59:41 +01:00
2941c5fc31 style 💎: Update template for creating Proxmox Debian LXC instance
Updated the create_proxmox_debian_template.yml to reflect changes in the lxc_create condition and added a new task to customize the Debian cloud image inside LXC. This change ensures consistency with the latest best practices for LXC configuration.
2025-11-08 08:56:30 +01:00
099fce9672 feat : Added new Debian Cloud Template directly from Proxmox
Created a new playbook to build and customize a Debian cloud image inside an LXC container, which is then imported as a Proxmox VM template.
2025-11-08 08:46:23 +01:00
1f9158d404 chore 📦: Update setupacdc.yml to remove deprecated lxc option
Removed the 'lxc.cap.keep=sys_time' option from the setupacdc.yml file as it is no longer supported, ensuring compatibility with newer LXC versions.
2025-11-07 18:29:12 +01:00
5ed3c8fdac chore 📦: Update setupacdc.yml to include lxc capability
Added a new LXC capability to the setupacdc.yml file, enabling sys_time keep for improved security
2025-11-07 18:06:10 +01:00
f6b28b5d0c chore 📦: Update setupacdc.yml to use pip and apk for package installation
Updated the setupacdc.yml file to utilize pip and apk for installing dependencies, ensuring consistency in package management across different environments.
2025-11-07 05:45:04 +01:00
ced7303db5 chore 📦: Update setupacdc.yml to use apk for py3-pexpect installation
Switched from pip to apk for installing py3-pexpect, as apk is the recommended package manager on the target system.
2025-11-06 21:24:57 +01:00
b6469d162f chore 📦: Update setupacdc.yml to install pexpect via pip instead of apk
Switched from using apk to pip for installing pexpect, simplifying the dependency management process.
2025-11-06 21:22:13 +01:00
31a1d1ce46 chore 📦: Update setupacdc.yml to include pexpect installation for Ansible controller
Added a new task to install pexpect on the Ansible controller, ensuring it's installed via apk. This change is part of the setup process and will enable the use of pexpect in future tasks.
2025-11-06 21:19:31 +01:00
1d779c29f9 chore 📦: Update dependencies in requirements.yml
Added a new dependency to the project, specifically the Proxmox collection. This change will enable the use of Proxmox as a collection in our project.
2025-11-06 20:43:10 +01:00
992df9b010 chore 📦: Update dependencies in requirements.yml
Added new dependency to the project, updating the requirements.yml file with the latest version.
2025-11-06 20:41:39 +01:00
a95251745e style 💎: Update collection names and remove unnecessary newline characters
Updated the requirements.yml files to reflect the correct collection naming convention, removing unnecessary newlines and updating the src attribute for one of the collections.
2025-11-06 20:40:19 +01:00
11def78ede chore 📦: Update timezone setup in setupacdc.yml
Updated the timezone setup to use a named timezone instead of a community.general.timezone, which is no longer available. This change simplifies the configuration and makes it easier to manage different timezones.
2025-11-06 20:36:37 +01:00
04adf0dcde style 💎: Update requirements.yml with new collection
Updated the list of required collections in the project's configuration file to include the latest version of Proxmox. This change ensures that the project can be properly installed and configured on a Proxmox server.
2025-11-06 20:31:12 +01:00
b959a7beb1 chore 📦: Update requirements.yml
Updated the list of dependencies in requirements.yml to ensure compatibility with the latest version of the Proxmox community collection.
2025-11-06 20:27:07 +01:00
1384be1251 style 💎: Update requirements.yml
Updated the list of required dependencies for the project, removing the community.proxmox collection and adding community.general.
2025-11-06 19:42:02 +01:00
7969b5fe7f chore 📦: Add new dependency to requirements.yml
Updated the list of dependencies in requirements.yml to include the new 'community.general' collection, allowing for easier management of project dependencies.
2025-11-06 19:03:58 +01:00
71c899b233 style 💎: Update container template and ostype in setupacdc.yml
Updated the container template to use Debian 13 standard and updated the container ostype from Ubuntu to Debian. This change reflects a shift in the distribution used for the container, allowing for more flexibility in the build process.
2025-11-05 20:37:01 +01:00
d3759dc082 chore 📦: Update setupacdc.yml to enable privileged containers by default
Changed the `container_unprivileged` setting from `1` to `0`, allowing for more flexibility in container configuration. This change will impact how containers are set up and managed in the project.
2025-11-05 20:33:21 +01:00
32a0f30520 chore 📦: Refactored package installation and update logic for consistency
Simplified the setupacdc.yml file by removing redundant tasks and improving readability. This change ensures that all necessary packages are installed and updated correctly, making it easier to maintain the configuration.
2025-11-05 19:22:41 +01:00
495cf1c384 refactor ♻️: Simplify setupacdc.yml by removing unnecessary tasks
Refactored the setupacdc.yml to remove redundant tasks and improve readability. This change simplifies the deployment process for Samba AD DC role.
2025-11-05 19:19:15 +01:00
a50362b9cf chore 📦: Update apt cache and install all available updates for setupacdc.yml
Updated the setupacdc.yml task to include installing an updated apt cache, upgrading packages, and performing a non-interactive Ubuntu release upgrade. This change enhances the overall reliability of the setup process.
2025-11-05 19:16:01 +01:00
c4d9e80c93 chore 📦: Update setupacdc.yml to include Ubuntu release upgrade and kernel reboot steps
Added new steps to the setupacdc.yml file to ensure a more robust Ubuntu installation process, including running the `do-release-upgrade` command and rebooting if a kernel update occurs. This change aims to improve the overall stability of the Samba AD DC role deployment.
2025-11-05 19:11:44 +01:00
b868f7715c chore 📦: Update container template and ostype in setupacdc.yml
Updated the container template and ostype from Debian to Ubuntu, reflecting a change in the underlying OS. This update ensures consistency with the new environment configuration.
2025-11-05 18:39:13 +01:00
4f58b7c299 style 💎: Update container template version
Updated the container template version in setupacdc.yml to match the latest Debian standard, removing unnecessary comments and formatting.
2025-11-04 21:11:31 +01:00
3ad717091b chore 📦: Update Debian template for setupacdc
Updated the Debian template in setupacdc.yml to use a newer version, ensuring compatibility with the latest dependencies.
2025-11-04 20:54:38 +01:00
8367c9c1bf chore 📦: Update setupacdc.yml to enable facts gathering for dc1 LXC
Enabled facts gathering for the dc1 LXC provision task, ensuring accurate inventory data collection. This change improves the overall reliability of the setup process.
2025-11-04 20:41:13 +01:00
e327754260 refactor ♻️: Improve formatting and consistency in setupacdc.yml
Refactored the setupacdc.yml file to improve formatting, consistency, and readability. This includes standardizing indentation, spacing, and variable naming conventions.
2025-11-04 19:18:58 +01:00
bb83d9368b style 💎: Update LXC container setup command
Updated the pct create command to include ssh-public-keys and features, ensuring consistency with other setup commands.
2025-11-04 19:12:16 +01:00
08c9123c76 chore 📦: Update setupacdc.yml to include debug logging
Added a new debug log statement to the setupacdc.yml file, allowing for more detailed output during container creation. This change enables users to see the value of the container_password variable in the logs. The update also includes minor formatting adjustments to improve readability.
2025-11-04 19:06:26 +01:00
a2deff2d43 style 💎: Update password format in setupacdc.yml
Updated the password format to use double quotes instead of single quotes for better readability and security.
2025-11-04 19:04:30 +01:00
064f775a13 style 💎: Update password format in setupacdc.yml
Updated the password format to use double quotes instead of single quotes, ensuring consistency with other configuration files.
2025-11-04 17:54:35 +01:00
3bf6f5f3ee chore 📦: Update setupacdc.yml with new password format
Updated the `container_password` field to use a more secure and consistent format, following the latest best practices for password storage. This change ensures that passwords are properly hashed and stored securely in the container configuration.
2025-11-04 17:53:35 +01:00
4d1ce5d020 style 💎: Update password format in setupacdc.yml
Updated the password format to use double quotes for better readability and consistency with other shell commands.
2025-11-04 17:51:36 +01:00
45f60c45dc style 💎: Update container password format in setupacdc.yml
Updated the container password field to use a templated value, ensuring consistency with other configuration settings.
2025-11-04 17:50:56 +01:00
eb61288865 chore 📦: Update setupacdc.yml to enable logging
Changed the `no_log` option from true to false in the setupacdc.yml file, allowing for log output during container creation. This change enables more detailed debugging and monitoring capabilities.
2025-11-04 17:49:52 +01:00
0c943620d6 style 💎: Update setupacdc.yml to enable logging by default
Changed the 'no_log' option from false to true in the setupacdc.yml file, enabling logging for containers. This change ensures that logs are generated and stored as expected.
2025-11-04 17:47:17 +01:00
1c1b2aa29f chore 📦: Update password variable in setupacdc.yml to use environment variable
Updated the password variable in the setupacdc.yml file to use an environment variable instead of a hardcoded value, making it easier to manage and secure sensitive information.
2025-11-04 17:46:54 +01:00
c30c7cf87d chore 📦: Update setupacdc.yml to remove unused debug tasks
Removed two unused debug tasks from the setupacdc.yml file, as they were not being used in the current workflow. This cleanup will improve the overall efficiency of the Ansible playbook.
2025-11-04 17:44:32 +01:00
c5fc0db06d chore 📦: Update setupacdc.yml to remove unused variable
Removed the `addc_admin_password` variable from the setupacdc.yml file, as it was not being used. This change simplifies the configuration and reduces unnecessary complexity.
2025-11-04 17:31:48 +01:00
5a8998539d style 💎: Update debug message with missing admin password variable
Updated the debug message to use the correct variable for the admin password, ensuring consistency in the output. This change improves readability and maintainability of the setup process.
2025-11-04 17:24:08 +01:00
0cc2e09e32 feat : Add new task to setupacdc.yml for saying hello
A new Ansible debug task has been added to the setupacdc.yml file, which prints a greeting message with the admin password. This change enhances the automation process by providing additional feedback during execution.
2025-11-04 17:23:27 +01:00
1aa9397e58 style 💎: Update password variable in setupacdc.yml
Updated the `addc_admin_password` variable to use the correct syntax, ensuring consistency with other variables in the file.
2025-11-03 21:17:25 +01:00
1c04312797 chore 📦: Update setupacdc.yml with new variable for admin password
Added a new variable to the setupacdc.yml file to store the admin password, making it easier to manage and update in the future.
2025-11-03 21:16:30 +01:00
6bf13f7a42 style 💎: Update debug message with admin password
Updated the debug message to include the admin password for better logging, making it easier to identify the source of issues.
2025-11-03 21:14:12 +01:00
ff63991e01 chore 📦: Update setupacdc.yml with new variables for Samba domain info
Added new variables to the setupacdc.yml file to store Samba domain admin password, allowing for easier configuration and management of the domain. This change enables more flexibility in the setup process.
2025-11-03 21:10:54 +01:00
c39c390ce9 chore 📦: Update setupacdc.yml to include Samba AD DC role
Updated the setupacdc.yml file to include the deployment of the Samba AD DC role, ensuring consistency with the latest Ansible roles. This change simplifies the setup process and reduces potential configuration errors.
2025-11-03 17:47:09 +01:00
15524c9d4b chore 📦: Update setupacdc.yml with new password variable
Updated the `container_password` variable to use a more secure method of storing sensitive information, and removed the hardcoded admin password from the configuration.
2025-11-03 17:45:12 +01:00
5a39683bdd chore 📦: Update setupacdc.yml to use Ansible's built-in variables
Updated the container_password variable from a string interpolation to a raw string literal, and removed the commented out line for deploying the Samba AD DC role. This change simplifies the playbook and reduces potential issues with variable expansion.
2025-11-03 17:44:22 +01:00
0241afcd2e chore 📦: Update password encryption in setupacdc.yml
Changed the way passwords are encrypted in the setupacdc.yml file, now using a hardcoded value instead of environment variable. This change simplifies the configuration process but may impact security if not handled properly.
2025-11-03 17:38:12 +01:00
26caf0c9ca style 💎: Update password and SSH keys in setupacdc.yml
Updated the password and SSH public keys configuration in the setupacdc.yml file to improve security and consistency.
2025-11-03 17:36:53 +01:00
0c2a97c5a3 style 💎: Update setupacdc.yml formatting and add quotes around variables
Updated the setupacdc.yml file to improve readability by adding quotes around variable names, ensuring consistency in formatting.
2025-11-03 17:35:27 +01:00
5be175fc51 style 💎: Update setupacdc.yml to remove unnecessary log flag
Removed the no_log flag from the setupacdc task, as it was not being used. This change simplifies the configuration and makes it easier to manage. The updated flag will be set to true by default in future changes.
2025-11-02 20:47:26 +01:00
5eb6f8b563 chore 📦: Update setupacdc.yml with new admin password variable
Updated the `container_password` variable to use a more secure and configurable approach, utilizing the `addc_admin_password` variable. This change allows for easier management of container passwords in the future.
2025-11-02 20:46:22 +01:00
38ad3f2599 chore 📦: Update setupacdc.yml to include Samba AD DC role deployment
Added a new task to deploy the Samba AD DC role using Ansible, allowing for more flexible and secure Active Directory deployments. This change enhances the overall setup process and improves its reliability.
2025-11-02 20:44:01 +01:00
10 changed files with 587 additions and 61 deletions

View File

@@ -3,3 +3,7 @@
collections:
# Install a collection by name
- name: community.proxmox
- name: community.general
- name: community.docker
- name: community.windows
- name: joshrnoll.homelab

View File

@@ -1,13 +1,24 @@
# requirements.yml
- src: arillso.localization
# - src: arillso.localization
# Role hosted in your private Gitea instance
- name: ansible_samba_ad_dc
src: https://repo.piave7.duckdns.org/Jose/ansible_samba_ad_dc.git
scm: git
- name: ansible_proxmox_vm
src: https://repo.piave7.duckdns.org/Jose/ansible_proxmox_VM.git
scm: git
- name: ansible-playbook-homelab
src: https://github.com/joshrnoll/ansible-playbook-homelab.git
scm: git
# version: master # or a specific tag/branch like 'v1.0.0'
- name: ansible-role-debian_common
src: https://repo.piave7.duckdns.org/Jose/ansible-role-debian_common.git
scm: git
# - name: ansible_samba_domain_member
# src: git@repo.piave7.duckdns.org:Jose/ansible_samba_domain_member.git # <-- Use the SSH URL
# scm: git

View File

@@ -0,0 +1,240 @@
---
- name: Build Debian Cloud Template directly from Proxmox
hosts: node0
become: true
gather_facts: false
vars_files:
- ../vars/debian_template.yml
vars:
lxc_name: "debian-builder"
# lxc_id: 9900
lxc_storage: "local-lvm"
# lxc_storage: "hdd8t"
lxc_template: "local:vztmpl/debian-13-standard_13.1-1_amd64.tar.zst"
lxc_ostype: "debian"
lxc_cores: 4
lxc_memory: 4096
lxc_swap: 0
lxc_net: "name=eth0,bridge=vmbr0,ip=dhcp"
lxc_rootfs_size: "8G"
lxc_password: "password"
tasks:
- block:
- name: Ensure build environment packages are installed on Proxmox
ansible.builtin.apt:
name:
# - libguestfs-tools
# - qemu-utils
- rsync
state: present
update_cache: true
- name: Ensure QEMU template directory exists on Proxmox host
ansible.builtin.file:
path: /var/lib/vz/template/qemu
state: directory
owner: root
group: root
mode: '0755'
- name: Combine SSH public keys into one file
ansible.builtin.copy:
dest: '{{ ssh_keys_file }}'
content: |
{% for key in ssh_public_keys %}
{{ key }}
{% endfor %}
mode: '0644'
- name: Create LXC build container
ansible.builtin.command: >
pct create {{ lxc_id }} {{ lxc_template }}
--hostname {{ lxc_name }}
--password '{{ lxc_password }}'
--ssh-public-keys '{{ ssh_keys_file }}'
--cores {{ lxc_cores }}
--memory {{ lxc_memory }}
--swap {{ lxc_swap }}
--ostype {{ lxc_ostype }}
--net0 {{ lxc_net }}
--storage {{ lxc_storage }}
--features nesting=1
--start
args:
creates: "/etc/pve/lxc/{{ lxc_id }}.conf"
- name: Check if LXC container {{ lxc_name }} is running
ansible.builtin.command:
cmd: pct status {{ lxc_id }}
register: pct_status
changed_when: false
- name: Start the LXC container {{ lxc_name }} if stopped
ansible.builtin.command:
cmd: pct start {{ lxc_id }}
when: "'status: stopped' in pct_status.stdout"
register: start_result
changed_when: "'status: stopped' in pct_status.stdout"
- name: Wait until container has an IP address
ansible.builtin.shell: "pct exec {{ lxc_id }} -- hostname -I | awk '{print $1}'"
register: lxc_ip
until: lxc_ip.stdout != ''
retries: 10
delay: 5
changed_when: false
failed_when: lxc_ip.stdout == ''
- name: Add temporary LXC to in-memory inventory
ansible.builtin.add_host:
name: lxc_builder
ansible_host: "{{ lxc_ip.stdout }}"
ansible_user: root
ansible_password: "{{ lxc_password }}"
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
- name: Customize Debian cloud image inside LXC
hosts: lxc_builder
become: true
vars_files:
- ../vars/debian_template.yml
tasks:
- block:
- name: Install build dependencies in LXC
ansible.builtin.apt:
name:
- qemu-utils
- libguestfs-tools
- curl
- wget
- rsync
- xz-utils
- nano
- htop
state: present
update_cache: true
- name: Ensure sudo is installed
ansible.builtin.apt:
name: sudo
state: present
- name: Create working directory
ansible.builtin.file:
path: "{{ workdir }}"
state: directory
- name: Download latest Debian genericcloud image
ansible.builtin.get_url:
url: "{{ debian_image_url }}"
dest: "{{ workdir }}/{{ image_name }}"
mode: "0644"
force: true
- name: Get QCOW2 image info
ansible.builtin.shell: "qemu-img info {{ workdir }}/{{ image_name }}"
register: image_info
- name: Show QCOW2 image details
ansible.builtin.debug:
msg: |
=== QCOW2 Image Info ===
{{ image_info.stdout }}
- name: Customize image with base utilities and root password
ansible.builtin.command: >
virt-customize -a {{ workdir }}/{{ image_name }}
--install "curl,wget,nano,rsync,htop"
--root-password password:{{ root_password }}
- name: Set DHCP identifier to hostname for cloud-init
ansible.builtin.shell: |
virt-customize -a {{ workdir }}/{{ image_name }} \
--run-command "echo 'dhcp-identifier: hostname' >> /etc/cloud/cloud.cfg.d/99_hostname.cfg"
- name: Reset machine-id
ansible.builtin.shell: |
virt-customize -a {{ workdir }}/{{ image_name }} \
--run-command 'truncate -s 0 /etc/machine-id && rm -f /var/lib/dbus/machine-id'
- name: Get QCOW2 image info
ansible.builtin.shell: "qemu-img info {{ workdir }}/{{ image_name }}"
register: image_info
- name: Show QCOW2 image details
ansible.builtin.debug:
msg: |
=== QCOW2 Image Info ===
{{ image_info.stdout }}
- name: Convert image to compressed qcow2
ansible.builtin.shell: |
qemu-img convert -O qcow2 -c {{ workdir }}/{{ image_name }} {{ workdir }}/{{ template_name }}.qcow2
args:
creates: "{{ workdir }}/{{ template_name }}.qcow2"
- name: Get QCOW2 image info
ansible.builtin.shell: "qemu-img info {{ workdir }}/{{ template_name }}.qcow2"
register: image_info
- name: Show QCOW2 image details
ansible.builtin.debug:
msg: |
=== QCOW2 Image Info ===
{{ image_info.stdout }}
- name: Import Debian Cloud image as Proxmox VM template
hosts: node0
become: true
vars_files:
- ../vars/debian_template.yml
tasks:
- block:
- name: Pull file from container to host using pct pull
command: pct pull "{{ lxc_id }}" {{ workdir }}/{{ template_name }}.qcow2 /var/lib/vz/template/qemu/{{ template_name }}.qcow2
- block:
- name: Import QCOW2 as disk to new VM
ansible.builtin.shell: >
qm create {{ proxmox_template_vm_id }}
--name {{ template_name }}
--memory 1024
--net0 virtio,bridge=vmbr0 &&
qm importdisk {{ proxmox_template_vm_id }}
/var/lib/vz/template/qemu/{{ template_name }}.qcow2 {{ proxmox_storage }}
- name: Configure VM for Cloud-Init
ansible.builtin.shell: |
qm set {{ proxmox_template_vm_id }} \
--scsihw virtio-scsi-pci \
--scsi0 {{ proxmox_storage }}:vm-{{ proxmox_template_vm_id }}-disk-0 \
--ide2 {{ proxmox_storage }}:cloudinit \
--boot c --bootdisk scsi0 \
--serial0 socket --vga serial0
- name: Convert VM to template
ansible.builtin.shell: "qm template {{ proxmox_template_vm_id }}"
- name: Stop and destroy LXC build container
ansible.builtin.shell: "pct stop {{ lxc_id }} && pct destroy {{ lxc_id }} --purge"
ignore_errors: true
- ansible.builtin.debug:
msg: "✅ Debian Cloud-Init template {{ template_name }} (VMID {{ proxmox_template_vm_id }}) created successfully!"

View File

@@ -1,4 +1,4 @@
- hosts: "{{ dest_hosts }}"
- hosts: '{{ dest_hosts }}'
gather_facts: yes
tasks:
@@ -46,7 +46,7 @@
- name: Show Details for Each Interface (Excluding Loopback)
ansible.builtin.debug:
var: hostvars['localhost']['ansible_' + item]
loop: "{{ ansible_interfaces }}"
loop: '{{ ansible_interfaces }}'
when: hostvars['localhost']['ansible_' + item] is defined and item not in ['lo']
# ----------------------------------------------------------------------

32
tasks/proxmox.yml Normal file
View File

@@ -0,0 +1,32 @@
- name: Deploy VM templates
hosts: proxmox
tasks:
- name: Install proxmoxer from APT
ansible.builtin.apt:
name: python3-proxmoxer
state: present
update_cache: yes
- name: Install lm-sensors from APT
ansible.builtin.apt:
name: lm-sensors
state: present
- name: Clone PVE-mods repository
ansible.builtin.git:
repo: "https://github.com/Meliox/PVE-mods.git"
dest: "/opt/PVE-mods"
version: "main"
update: yes
- name: Install pve-mod-gui-sensors.sh
ansible.builtin.copy:
src: "/opt/PVE-mods/pve-mod-gui-sensors.sh"
dest: "/usr/local/bin/pve-mod-gui-sensors.sh"
mode: "0755"
- name: Run script with predefined input
ansible.builtin.shell: |
printf "a\nC\nN\n2\n" | /usr/local/bin/pve-mod-gui-sensors.sh

View File

@@ -0,0 +1,11 @@
---
- name: Build Debian Template
hosts: node0
become: true
gather_facts: false
tasks:
- name: Deploy the debian template
ansible.builtin.include_role:
name: ansible_proxmox_vm

View File

@@ -1,4 +1,25 @@
---
# - name: Install pexpect on Ansible controller
# hosts: localhost
# gather_facts: false
# tasks:
# - name: Install pexpect via pip
# ansible.builtin.pip:
# name: pexpect
# executable: pip3
# - name: Install py3-pexpect
# ansible.builtin.apk:
# name: py3-pexpect
# state: present
# - name: Ensure pexpect is installed via apk
# ansible.builtin.apk:
# name: py3-pexpect
# state: present
- name: Create and provision LXC container on Proxmox
hosts: node0
gather_facts: no
@@ -6,27 +27,30 @@
become_user: root
vars:
node_ip: "{{ hostvars['node0']['ansible_host'] }}"
mac_address: "8E:90:31:DE:31:36"
node_ip: "{{ hostvars['node0']['ansible_host'] }}"
mac_address: '8E:90:31:DE:31:36'
container_id: 200
container_template: "/var/lib/vz/template/cache/debian-13-standard_13.1-1_amd64.tar.zst"
container_ostype: debian
container_hostname: "{{ addc_hostname }}"
container_password: 123456
container_storage: local-lvm
container_rootfs_size: 8G
container_memory: 1024
container_swap: 256
container_cores: 2
container_net: name=eth0,bridge=vmbr0,ip={{ addc_ansible_host }}/24,gw={{ location_gateway }},hwaddr={{ mac_address }}
container_features: "keyctl=1,nesting=1,mount=cifs"
container_description: default lxc
container_onboot: 1
container_protection: 0
container_unprivileged: 1
container_pubkey: "{{ ssh_public_keys[0] }}"
container_tags:
lxc_id: 200
# lxc_template: '/var/lib/vz/template/cache/ubuntu-25.04-standard_25.04-1.1_amd64.tar.zst'
lxc_template: '/var/lib/vz/template/cache/debian-13-standard_13.1-1_amd64.tar.zst'
# lxc_template: '/var/lib/vz/template/cache/debian-12-standard_12.12-1_amd64.tar.zst'
# lxc_ostype: ubuntu
lxc_ostype: debian
lxc_hostname: '{{ addc_hostname }}'
lxc_password: '{{ addc_admin_password }}'
lxc_storage: local-lvm
lxc_rootfs_size: 8G
lxc_memory: 1024
lxc_swap: 256
lxc_cores: 2
lxc_net: name=eth0,bridge=vmbr0,ip={{ addc_ansible_host }}/24,gw={{ location_gateway }},hwaddr={{ mac_address }}
lxc_features: 'keyctl=1,nesting=1,mount=cifs'
lxc_description: default lxc
lxc_onboot: 1
lxc_protection: 0
lxc_unprivileged: 0
lxc_pubkey: '{{ ssh_public_keys[0] }}'
lxc_tags:
- ansible_managed
- test
@@ -34,64 +58,72 @@
- name: Combine SSH public keys into one file
ansible.builtin.copy:
dest: "{{ ssh_keys_file }}"
dest: '{{ ssh_keys_file }}'
content: |
{% for key in ssh_public_keys %}
{{ key }}
{% endfor %}
mode: '0644'
- name: Create LXC container {{ container_hostname }} with id {{ container_id }} using pct command on shell
ansible.builtin.shell: |
pct create {{ container_id }} {{ container_template }} \
-ostype {{ container_ostype }} \
-hostname {{ container_hostname }} \
-password {{ container_password }} \
-ssh-public-keys {{ ssh_keys_file }} \
-cores {{ container_cores }} \
-memory {{ container_memory }} \
-swap {{ container_swap }} \
-net0 {{container_net}} \
-storage {{ container_storage }} \
-description "{{ container_description }}" \
-onboot {{ container_onboot }} \
-protection {{ container_protection }} \
-unprivileged {{ container_unprivileged }} \
-tags "{{ container_tags | join(',') }}" \
-features {{ container_features }}
args:
creates: "/etc/pve/lxc/{{ container_id }}.conf"
no_log: true
- name: debug
# Comment
ansible.builtin.debug:
msg: 'Hello world! {{ lxc_password }}'
verbosity: 0
# -rootfs {{ container_storage }}:{{ container_id }}/vm-{{ container_id }}-disk-0.raw,size=7G \
- name: Create LXC container {{ lxc_hostname }} with id {{ lxc_id }} using pct command on shell
ansible.builtin.shell: |
set -e
pct create {{ lxc_id }} {{ lxc_template }} \
-ostype {{ lxc_ostype }} \
-hostname {{ lxc_hostname }} \
-password '{{ lxc_password }}' \
-ssh-public-keys '{{ ssh_keys_file }}' \
-cores {{ lxc_cores }} \
-memory {{ lxc_memory }} \
-swap {{ lxc_swap }} \
-net0 '{{lxc_net}}' \
-storage {{ lxc_storage }} \
-description '{{ lxc_description }}' \
-onboot {{ lxc_onboot }} \
-protection {{ lxc_protection }} \
-unprivileged {{ lxc_unprivileged }} \
-tags '{{ lxc_tags | join(',') }}' \
-features '{{ lxc_features }}'
args:
creates: '/etc/pve/lxc/{{ lxc_id }}.conf'
no_log: false
# -password {{ lxc_password }} \
# -rootfs {{ lxc_storage }}:{{ lxc_id }}/vm-{{ lxc_id }}-disk-0.raw,size=7G \
# -timezone: {{ localization_timezone }} \
- name: Check if LXC container {{ container_hostname }} is running
- name: Check if LXC container {{ lxc_hostname }} is running
ansible.builtin.command:
cmd: pct status {{ container_id }}
cmd: pct status {{ lxc_id }}
register: pct_status
changed_when: false
- name: Start the LXC container {{ container_hostname }} if stopped
- name: Start the LXC container {{ lxc_hostname }} if stopped
ansible.builtin.command:
cmd: pct start {{ container_id }}
cmd: pct start {{ lxc_id }}
when: "'status: stopped' in pct_status.stdout"
register: start_result
changed_when: "'status: stopped' in pct_status.stdout"
- name: Wait until container has an IP address
ansible.builtin.shell: "pct exec {{ container_id }} -- hostname -I | awk '{print $1}'"
ansible.builtin.shell: "pct exec {{ lxc_id }} -- hostname -I | awk '{print $1}'"
register: lxc_ip
until: lxc_ip.stdout != ""
until: lxc_ip.stdout != ''
retries: 10
delay: 5
changed_when: false
failed_when: lxc_ip.stdout == ""
failed_when: lxc_ip.stdout == ''
- name: Wait for SSH to become available
ansible.builtin.wait_for:
host: "{{ lxc_ip.stdout }}"
host: '{{ lxc_ip.stdout }}'
port: 22
delay: 5
timeout: 60
@@ -103,18 +135,55 @@
- name: Provision dc1 LXC
hosts: dc1
gather_facts: false
gather_facts: true
become: true
# vars:
# addc_admin_password: '{{ addc_adminpass }}'
tasks:
# - name: Ensure SSH authorized keys are present
# ansible.posix.authorized_key:
# user: root
# key: "{{ item }}"
# key: '{{ item }}'
# state: present
# loop: "{{ ssh_public_keys }}"
# loop: '{{ ssh_public_keys }}'
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
- name: Install all available updates
ansible.builtin.apt:
upgrade: dist
autoremove: true
- name: Reboot if a new kernel was installed
ansible.builtin.reboot:
msg: "Rebooting after full upgrade"
connect_timeout: 5
reboot_timeout: 600
when: ansible_facts.packages is not defined or
ansible_facts.packages['linux-image-generic'] is defined
# - name: Ensure update-manager-core is installed
# ansible.builtin.apt:
# name: update-manager-core
# state: present
# - name: Perform Ubuntu release upgrade non-interactively
# ansible.builtin.command:
# cmd: do-release-upgrade -f DistUpgradeViewNonInteractive
# register: upgrade_output
# changed_when: "'No new release found' not in upgrade_output.stdout"
# - name: Reboot if kernel updated
# ansible.builtin.reboot:
# msg: "Rebooting after Ubuntu upgrade"
# connect_timeout: 5
# reboot_timeout: 600
# when: upgrade_output is changed
- name: Install useful packages
ansible.builtin.package:
@@ -126,18 +195,25 @@
- name: Update all packages, autoclean, and autoremove
ansible.builtin.apt:
name: "*"
name: '*'
state: latest
autoclean: yes
autoremove: yes
purge: true
- name: Set timezone to {{ localization_timezone }}
community.general.timezone:
name: "{{ localization_timezone }}"
# community.general.timezone:
timezone:
name: '{{ localization_timezone }}'
notify: Restart sshd
tags: [timezone]
- name: Deploy the Samba AD DC role
ansible.builtin.include_role:
name: ansible_samba_ad_dc
# --- Global Handlers ----------------------------------------------
handlers:

124
tasks/testing.yml Normal file
View File

@@ -0,0 +1,124 @@
---
- name: Deploy VM templates
hosts: node0
tasks:
# - name: Import variables from Ansible vault
# ansible.builtin.include_vars: secrets.yml
- name: Install proxmoxer from APT
apt:
name: python3-proxmoxer
state: present
update_cache: yes
- name: "[PREFLIGHT] Check if 'snippets' is already enabled for {{ proxmox_snippets_storage }}"
ansible.builtin.command: "grep -E 'dir:\\s*{{ proxmox_snippets_storage }}' -A5 /etc/pve/storage.cfg"
register: snippets_check
failed_when: false
changed_when: false
vars:
proxmox_snippets_storage: local
- name: "[PREFLIGHT] Determine whether 'snippets' is already configured"
ansible.builtin.set_fact:
snippets_already_present: "{{ 'snippets' in snippets_check.stdout }}"
- name: "[PREFLIGHT] Ensure 'snippets' is enabled for {{ proxmox_snippets_storage }}"
ansible.builtin.replace:
path: /etc/pve/storage.cfg
regexp: '(dir:\s*{{ proxmox_snippets_storage }}[\s\S]*?content\s+)(.*)(?<!snippets)'
replace: '\1\2,snippets'
when: not snippets_already_present
vars:
proxmox_snippets_storage: local
- name: "[PREFLIGHT] Ensure snippets storage directory exists"
ansible.builtin.file:
path: "{{ proxmox_snippets_storage_path }}/snippets"
state: directory
mode: "0755"
vars:
proxmox_snippets_storage_path: /var/lib/vz
- name: Deploy templates with proxmox_template_vm
ansible.builtin.include_role:
name: joshrnoll.homelab.proxmox_template_vm
vars:
proxmox_template_vm_supported_distros:
- fedora
- ubuntu
- debian
proxmox_template_vm_debian_image: debian-13-genericcloud-amd64-20251117-2299.qcow2
proxmox_template_vm_debian_image_url: https://cloud.debian.org/images/cloud/trixie/20251117-2299/debian-13-genericcloud-amd64-20251117-2299.qcow2
proxmox_template_vm_debian_ostype: l26
# Required to provide at least one
proxmox_template_vm_distros:
- debian
# Required proxmox credentials
proxmox_template_vm_proxmox_username: "{{ proxmox_username }}" # From Ansible vault
proxmox_template_vm_proxmox_api_token_id: "{{ proxmox_api_token_id }}" # From Ansible vault
proxmox_template_vm_proxmox_api_token_secret: "{{ proxmox_api_token_secret }}" # From Ansible vault
# Optional customizations for debian
proxmox_template_vm_debian_name: debian-template
proxmox_template_vm_debian_memory: 2048
proxmox_template_vm_debian_cores: 2
proxmox_template_vm_debian_storage: local-lvm
proxmox_template_vm_debian_ciuser: "{{ ciuser }}" # From Ansible vault
proxmox_template_vm_debian_cipassword: "{{ cipassword }}" # From Ansible vault
proxmox_template_vm_debian_sshkeys: "{{ ssh_public_keys | join('\n') }}" # gets your ssh key from /home/user/.ssh/id_rsa.pub -- customize this to your needs
# proxmox_template_vm_debian_vlan: 50
# Set to true if you have slow storage to avoid file locks
proxmox_template_vm_slow_storage: true
- name: Deploy VMs
ansible.builtin.include_role:
name: joshrnoll.homelab.create_proxmox_vms
vars:
# Proxmox credentials
create_proxmox_vms_proxmox_username: "{{ proxmox_username }}"
create_proxmox_vms_proxmox_api_token_id: "{{ proxmox_api_token_id }}"
create_proxmox_vms_proxmox_api_token_secret: "{{ proxmox_api_token_secret }}"
# VMs to be created
create_proxmox_vms_list:
- name: dc1
template: 9412
vmid: 1000
memory: 2048
cores: 2
node: node0 # The hostname of the node that the VM will be created on
ciuser: "{{ ciuser }}"
cipassword: "{{ cipassword }}"
# sshkeys: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
storage: local-lvm
disk_size: 8G
# vlan: 50
ip_address: 192.168.2.3/24
gateway: 192.168.2.1
nameservers:
- 192.168.2.100
- 8.8.8.8
- name: Test common role
hosts: dc1
tasks:
- name: Deploy VMs
ansible.builtin.include_role:
name: ansible-role-debian_common
# vars:
# # Proxmox credentials
# ansible_user: "{{ ciuser }}"
# ansible_password: "{{ cipassword }}"

17
tasks/testvault.yml Normal file
View File

@@ -0,0 +1,17 @@
---
- name: Test secrets.yml
hosts: localhost
vars:
admin_user: joseadm
admin_password: changeme
tasks:
# - name: Import variables from Ansible vault
# ansible.builtin.include_vars:
# ../../secrets.yml
- name: debug secrets.yml"
ansible.builtin.debug:
msg: "The value of the secret is {{ test_password }}"

11
vars/debian_template.yml Normal file
View File

@@ -0,0 +1,11 @@
---
workdir: "/tmp/debian_template_build"
debian_image_url: "https://cloud.debian.org/images/cloud/trixie/latest/debian-13-generic-amd64.qcow2"
image_name: "debian-13-genericcloud-amd64.qcow2"
template_name: "debian-13-cloudinit-template"
root_password: "debian"
proxmox_storage: "local-lvm"
proxmox_template_vm_id: 9000
lxc_id: 9900