Compare commits

..

29 Commits

Author SHA1 Message Date
dc52a02df7 refactor ♻️: Refactor uninstall script task to use ansible.builtin.shell instead of ansible.builtin.command
Updated the uninstall script task to use `ansible.builtin.shell` for better command execution and flexibility.
2025-12-16 21:05:38 +01:00
3c4d7d73b5 refactor ♻️: Remove unnecessary conditional check and registration in Proxmox task
Refactored the Proxmox task code by removing redundant conditional checks and registration steps, simplifying the logic and improving performance.
2025-12-16 21:02:08 +01:00
651bf323df refactor ♻️: Refactor Proxmox playbook to use ansible.builtin.expect with ignore_errors
Updated the `proxmox.yml` file to include the use of `ansible.builtin.expect` module and set `ignore_errors` to handle exceptions gracefully.
2025-12-16 21:00:08 +01:00
d7726852ea refactor ♻️: Replace PVE-mods repository cloning with direct script download and execution.
Refactored the project to eliminate the need for cloning a repository by instead downloading and executing a script directly. This simplifies the setup process and reduces dependency on external repositories.
2025-12-16 20:56:19 +01:00
6370fbad21 refactor ♻️: Refactor uninstall/install scripts to use bash
Updated the uninstall and install scripts to use bash for better compatibility across different environments.
2025-12-16 20:49:28 +01:00
2c03831394 refactor ♻️: Refactor shell to command in proxmox.yml task
Updated the task in proxmox.yml to use 'command' instead of 'shell' for better clarity and consistency.
2025-12-16 20:42:03 +01:00
6d7748a127 refactor ♻️: Refactor shell task in proxmox.yml to use 'cmd' keyword
Updated the shell task in proxmox.yml to utilize the 'cmd' keyword for better readability and consistency.
2025-12-16 20:39:02 +01:00
aa640fa23f chore 📦: Add python3-pexpect to package list
Updated the package list to include python3-pexpect for enhanced automation capabilities.
2025-12-16 20:36:04 +01:00
a08dfae843 feat : Add ignore_errors, when condition, and reset fact; update script registration
This commit introduces new functionality to include error handling, conditional execution, and state reset in scripts. It also updates the script registration process to ensure compatibility with these changes.
2025-12-16 19:55:28 +01:00
8005cd5dd7 feat : Add wait-for task to ensure Proxmox Web GUI is up before running scripts.
This commit introduces a new wait-for task that waits for the Proxmox Web GUI to be fully operational before proceeding with subsequent scripts. This ensures that all dependencies are ready, preventing potential errors during script execution.
2025-12-16 19:29:37 +01:00
ae2af0ce6c refactor ♻️: Rename task to 'Run uninstall script' and update command
Refactored the task name and updated the associated command for clarity and consistency.
2025-12-16 19:25:16 +01:00
7854c4f95c feat : Add sensor monitoring task script
Introduce a new task to execute the `pve-mod-gui-sensors.sh` script with predefined answers, enhancing system monitoring capabilities.
2025-12-16 19:21:29 +01:00
d026ef8d1b refactor ♻️: Consolidate and update pkg list
Refactored package installation process by consolidating and updating the `pkg` list to improve efficiency and maintainability.
2025-12-16 18:35:57 +01:00
0b0ef1a385 fix 🐛: Fix typo in remote_src setting
Corrected a typographical error in the configuration option 'remote_src' to ensure proper functionality.
2025-12-16 18:26:33 +01:00
a58623dfcd feat : Add remote source support for copy script
This feature allows scripts to be copied from a remote source, enhancing flexibility and scalability in deployment processes.
2025-12-16 18:24:54 +01:00
89dabc0a70 chore 📦: Add pre-installation check for git
This commit adds a step to verify that git is installed on the system before proceeding with the installation of proxmoxer. This ensures compatibility and prevents potential errors during the setup process.
2025-12-16 18:18:33 +01:00
af0298410c feat : Add new feature
This is a new feature
2025-12-16 17:43:51 +01:00
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
4 changed files with 100 additions and 53 deletions

View File

@@ -10,11 +10,15 @@
src: https://repo.piave7.duckdns.org/Jose/ansible_proxmox_VM.git src: https://repo.piave7.duckdns.org/Jose/ansible_proxmox_VM.git
scm: git scm: git
- name: ansible_proxmox_vm - name: ansible-playbook-homelab
src: https://github.com/joshrnoll/ansible-playbook-homelab.git src: https://github.com/joshrnoll/ansible-playbook-homelab.git
scm: git scm: git
# version: master # or a specific tag/branch like 'v1.0.0' # 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 # - name: ansible_samba_domain_member
# src: git@repo.piave7.duckdns.org:Jose/ansible_samba_domain_member.git # <-- Use the SSH URL # src: git@repo.piave7.duckdns.org:Jose/ansible_samba_domain_member.git # <-- Use the SSH URL
# scm: git # scm: git

54
tasks/proxmox.yml Normal file
View File

@@ -0,0 +1,54 @@
- name: Setup Proxmox
hosts: proxmox
become: true
tasks:
- name: Ensure git is installed
ansible.builtin.apt:
pkg:
- git
- python3-proxmoxer
- lm-sensors
- python3-pexpect
state: present
update_cache: yes
cache_valid_time: 3600
- name: Download the PVE GUI sensors script
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/Meliox/PVE-mods/refs/heads/main/pve-mod-gui-sensors.sh
dest: /tmp/pve-mod-gui-sensors.sh
mode: '0755' # Make it executable
- name: Run uninstall script
ansible.builtin.shell: bash /tmp/pve-mod-gui-sensors.sh uninstall
ignore_errors: true
- name: Wait for Proxmox Web GUI to be up
wait_for:
port: 8006
delay: 5
timeout: 60
- name: Reset install fact
ansible.builtin.set_fact:
pve_mod_gui_sensors_installed: null
- name: Run pve-mod-gui-sensors script with predefined answers
ansible.builtin.expect:
command: bash /tmp/pve-mod-gui-sensors.sh install
responses:
'Display temperatures for all cores \[C\] or average per CPU \[a\].*\(C/a\):.*': 'a'
'Display temperatures in Celsius \[C\] or Fahrenheit \[f\].*\(C/f\):.*': 'c'
'Enable UPS information\?.*\(y/N\):.*': 'n'
'Enable system information\?.*\(1/2/n\):.*': '2'
ignore_errors: true
- name: Wait for Proxmox Web GUI to be up
wait_for:
port: 8006
delay: 5
timeout: 60

View File

@@ -1,3 +1,4 @@
---
- name: Deploy VM templates - name: Deploy VM templates
hosts: node0 hosts: node0
@@ -50,57 +51,30 @@
- ubuntu - ubuntu
- debian - debian
proxmox_template_vm_fedora_image: Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
proxmox_template_vm_fedora_image_url: https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
proxmox_template_vm_ubuntu_image: jammy-server-cloudimg-amd64.img
proxmox_template_vm_ubuntu_image_url: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
proxmox_template_vm_debian_image: debian-13-genericcloud-amd64-20251117-2299.qcow2 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_image_url: https://cloud.debian.org/images/cloud/trixie/20251117-2299/debian-13-genericcloud-amd64-20251117-2299.qcow2
proxmox_template_vm_ubuntu_ostype: l26
proxmox_template_vm_fedora_ostype: l26
proxmox_template_vm_debian_ostype: l26 proxmox_template_vm_debian_ostype: l26
proxmox_template_vm_ubuntu_osvariant: ubuntu-20.04
proxmox_template_vm_debian_name: debian-template
proxmox_template_vm_debian_memory: 4096
proxmox_template_vm_debian_cores: 2
proxmox_template_vm_debian_storage: local-lvm
# Required to provide at least one # Required to provide at least one
proxmox_template_vm_distros: proxmox_template_vm_distros:
- debian - debian
- ubuntu
# Required proxmox credentials # Required proxmox credentials
proxmox_template_vm_proxmox_username: "{{ proxmox_username }}" # From Ansible vault 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_id: "{{ proxmox_api_token_id }}" # From Ansible vault
proxmox_template_vm_proxmox_api_token_secret: "{{ proxmox_api_token_secret }}" # From Ansible vault proxmox_template_vm_proxmox_api_token_secret: "{{ proxmox_api_token_secret }}" # From Ansible vault
# Optional customizations for debian # Optional customizations for debian
proxmox_template_vm_debian_storage: "local-lvm" proxmox_template_vm_debian_name: debian-template
proxmox_template_vm_debian_name: debian-40-template
proxmox_template_vm_debian_memory: 2048 proxmox_template_vm_debian_memory: 2048
proxmox_template_vm_debian_cores: 1 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_ciuser: "{{ ciuser }}" # From Ansible vault
proxmox_template_vm_debian_cipassword: "{{ cipassword }}" # 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_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 # proxmox_template_vm_debian_vlan: 50
# Optional customizations for ubuntu
proxmox_template_vm_ubuntu_storage: "local-lvm"
proxmox_template_vm_ubuntu_name: ubuntu-2204-template
proxmox_template_vm_ubuntu_memory: 4096
proxmox_template_vm_ubuntu_cores: 1
proxmox_template_vm_ubuntu_ciuser: "{{ ciuser }}" # From Ansible vault
proxmox_template_vm_ubuntu_cipassword: "{{ cipassword }}" # From Ansible vault
# proxmox_template_vm_ubuntu_sshkeys: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/id_rsa.pub') }}" # gets your ssh key from /home/user/.ssh/id_rsa.pub -- customize this to your needs
proxmox_template_vm_ubuntu_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_ubuntu_vlan: 50
# Set to true if you have slow storage to avoid file locks # Set to true if you have slow storage to avoid file locks
proxmox_template_vm_slow_storage: true proxmox_template_vm_slow_storage: true
@@ -115,38 +89,36 @@
# VMs to be created # VMs to be created
create_proxmox_vms_list: create_proxmox_vms_list:
- name: vm-01 - name: dc1
template: 9412 template: 9412
vmid: 1000 vmid: 1000
memory: 8192 memory: 2048
cores: 2 cores: 2
node: node0 # The hostname of the node that the VM will be created on node: node0 # The hostname of the node that the VM will be created on
ciuser: "{{ ciuser }}" ciuser: "{{ ciuser }}"
cipassword: "{{ cipassword }}" cipassword: "{{ cipassword }}"
# sshkeys: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}" # sshkeys: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
storage: local-lvm storage: local-lvm
disk_size: 32G disk_size: 8G
# vlan: 50 # vlan: 50
ip_address: 192.168.2.98/24 ip_address: 192.168.2.3/24
gateway: 192.168.2.1 gateway: 192.168.2.1
nameservers: nameservers:
- 192.168.2.100 - 192.168.2.100
- 8.8.8.8 - 8.8.8.8
- name: vm-02
vmid: 1001 - name: Test common role
template: 9413 hosts: dc1
memory: 4096
cores: 1 tasks:
node: node0 # The hostname of the node that the VM will be created on - name: Deploy VMs
ciuser: "{{ ciuser }}" ansible.builtin.include_role:
cipassword: "{{ cipassword }}" name: ansible-role-debian_common
# sshkeys: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
storage: local-lvm # vars:
disk_size: 64G # # Proxmox credentials
# vlan: 50 # ansible_user: "{{ ciuser }}"
ip_address: 192.168.2.99/24 # ansible_password: "{{ cipassword }}"
gateway: 192.168.2.1
nameservers:
- 192.168.2.100
- 8.8.8.8

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 }}"