Compare commits

...

27 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
4 changed files with 86 additions and 27 deletions

View File

@@ -10,11 +10,15 @@
src: https://repo.piave7.duckdns.org/Jose/ansible_proxmox_VM.git
scm: git
- name: ansible_proxmox_vm
- 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

@@ -1,32 +1,54 @@
- name: Deploy VM templates
- name: Setup Proxmox
hosts: proxmox
become: true
tasks:
- name: Install proxmoxer from APT
- name: Ensure git is installed
ansible.builtin.apt:
name: python3-proxmoxer
pkg:
- git
- python3-proxmoxer
- lm-sensors
- python3-pexpect
state: present
update_cache: yes
cache_valid_time: 3600
- name: Install lm-sensors from APT
ansible.builtin.apt:
name: lm-sensors
state: present
- 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: Clone PVE-mods repository
ansible.builtin.git:
repo: "https://github.com/Meliox/PVE-mods.git"
dest: "/opt/PVE-mods"
version: "main"
update: yes
- name: Run uninstall script
ansible.builtin.shell: bash /tmp/pve-mod-gui-sensors.sh uninstall
ignore_errors: true
- 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: Wait for Proxmox Web GUI to be up
wait_for:
port: 8006
delay: 5
timeout: 60
- name: Run script with predefined input
ansible.builtin.shell: |
printf "a\nC\nN\n2\n" | /usr/local/bin/pve-mod-gui-sensors.sh
- 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
hosts: node0
@@ -64,7 +65,6 @@
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
@@ -89,10 +89,10 @@
# VMs to be created
create_proxmox_vms_list:
- name: vm-01
- name: dc1
template: 9412
vmid: 1000
memory: 8192
memory: 2048
cores: 2
node: node0 # The hostname of the node that the VM will be created on
ciuser: "{{ ciuser }}"
@@ -101,8 +101,24 @@
storage: local-lvm
disk_size: 8G
# vlan: 50
ip_address: 192.168.2.98/24
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 }}"