Compare commits
29 Commits
0a18c43555
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| dc52a02df7 | |||
| 3c4d7d73b5 | |||
| 651bf323df | |||
| d7726852ea | |||
| 6370fbad21 | |||
| 2c03831394 | |||
| 6d7748a127 | |||
| aa640fa23f | |||
| a08dfae843 | |||
| 8005cd5dd7 | |||
| ae2af0ce6c | |||
| 7854c4f95c | |||
| d026ef8d1b | |||
| 0b0ef1a385 | |||
| a58623dfcd | |||
| 89dabc0a70 | |||
| af0298410c | |||
| f6c9c70fcd | |||
| 066a599d9b | |||
| 8f25ef2a14 | |||
| a4b6ecd9f1 | |||
| c4d6dd8f4b | |||
| 914d6de8b6 | |||
| aa8b2375db | |||
| 5288b88fcd | |||
| ce8d5a7811 | |||
| f954fd25b3 | |||
| 8289e73119 | |||
| fe78fd6fe7 |
@@ -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
54
tasks/proxmox.yml
Normal 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
|
||||||
|
|
||||||
@@ -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
17
tasks/testvault.yml
Normal 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 }}"
|
||||||
|
|
||||||
Reference in New Issue
Block a user