Update playbooks/new_lxc.yml
This commit is contained in:
+8
-10
@@ -19,6 +19,14 @@
|
|||||||
lxc_ssh_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINegitHaQG8i+s412h3wTWf/KvpeX1CEpYFva9MhHR+7 ansible-key"
|
lxc_ssh_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINegitHaQG8i+s412h3wTWf/KvpeX1CEpYFva9MhHR+7 ansible-key"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
# ========================================================================
|
||||||
|
# NEW FIX: Auto-install missing dependencies into Semaphore's isolated venv
|
||||||
|
# ========================================================================
|
||||||
|
- name: Ensure Proxmox API dependencies are installed in Semaphore
|
||||||
|
ansible.builtin.shell: "{{ ansible_playbook_python }} -m pip install proxmoxer requests"
|
||||||
|
changed_when: false
|
||||||
|
# ========================================================================
|
||||||
|
|
||||||
- name: Get the next available VMID from the Proxmox cluster
|
- name: Get the next available VMID from the Proxmox cluster
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "https://{{ proxmox_api_host }}:8006/api2/json/cluster/nextid"
|
url: "https://{{ proxmox_api_host }}:8006/api2/json/cluster/nextid"
|
||||||
@@ -45,20 +53,10 @@
|
|||||||
ostemplate: "{{ lxc_template }}"
|
ostemplate: "{{ lxc_template }}"
|
||||||
cores: "{{ lxc_cores }}"
|
cores: "{{ lxc_cores }}"
|
||||||
memory: "{{ lxc_memory }}"
|
memory: "{{ lxc_memory }}"
|
||||||
|
|
||||||
# FIX: Combined storage pool and size into the single required format
|
|
||||||
disk: "{{ lxc_storage }}:{{ lxc_disk_size }}"
|
disk: "{{ lxc_storage }}:{{ lxc_disk_size }}"
|
||||||
|
|
||||||
# Configure network for DHCP on the specified bridge
|
|
||||||
netif: '{"net0":"name=eth0,bridge={{ lxc_bridge }},ip=dhcp"}'
|
netif: '{"net0":"name=eth0,bridge={{ lxc_bridge }},ip=dhcp"}'
|
||||||
|
|
||||||
# Explicitly set the DNS nameserver
|
|
||||||
nameserver: "{{ lxc_dns }}"
|
nameserver: "{{ lxc_dns }}"
|
||||||
|
|
||||||
# Inject the SSH public key
|
|
||||||
pubkey: "{{ lxc_ssh_key }}"
|
pubkey: "{{ lxc_ssh_key }}"
|
||||||
|
|
||||||
# Highly recommended security flag for Proxmox containers
|
|
||||||
unprivileged: true
|
unprivileged: true
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user