34 lines
946 B
YAML
34 lines
946 B
YAML
---
|
|
- name: Check if container already exists
|
|
shell: pct list | grep 221 || true
|
|
register: container_check
|
|
delegate_to: proxmox
|
|
changed_when: false
|
|
|
|
- name: Create Gateway LXC container using correct template path
|
|
shell: |
|
|
pct create 221 \
|
|
"/mnt/pve/vmbackup/template/cache/ubuntu-24.04-standard_24.04-2_amd64.tar.zst" \
|
|
--rootfs vmsystem:5 \
|
|
--cores 1 \
|
|
--memory 2048 \
|
|
--swap 512 \
|
|
--hostname gateway \
|
|
--net0 name=eth0,bridge=vmbr0,ip=192.168.1.221/24,gw=192.168.1.1 \
|
|
--storage vmsystem \
|
|
--password "{{ proxmox_root_password }}" \
|
|
--unprivileged 1 \
|
|
--start 1
|
|
args:
|
|
executable: /bin/bash
|
|
delegate_to: proxmox
|
|
when:
|
|
- "'221' not in container_check.stdout"
|
|
- "template_check.rc == 0"
|
|
|
|
- name: Wait for container to start
|
|
wait_for_connection:
|
|
host: 192.168.1.221
|
|
port: 22
|
|
timeout: 120
|
|
delay: 10 |