Update file main.yml

This commit is contained in:
Administrator 2025-10-10 15:59:39 +00:00
parent 51c882a2af
commit 66dcbe6c3a

View File

@ -1,20 +1,32 @@
--- ---
- name: Create Gateway LXC container - name: Check if container already exists
community.proxmox.proxmox_lxc: shell: pct list | grep 221 || true
node: "{{ proxmox_node }}" register: container_check
vmid: 221 delegate_to: "{{ groups['proxmox_servers'][0] }}"
hostname: gateway changed_when: false
storage: "vmsystem"
cores: 1 - name: Create Gateway LXC container using pct command
memory: 2048 shell: |
swap: 512 pct create 221 \
rootfs: "vmsystem:5" /var/lib/vz/template/cache/ubuntu-24.04-standard_24.04-2_amd64.tar.zst \
template: "ubuntu-24.04-standard_24.04-2_amd64.tar.zst" --rootfs vmsystem:5 \
password: "{{ proxmox_root_password }}" --cores 1 \
net: --memory 2048 \
name: eth0 --swap 512 \
bridge: vmbr0 --hostname gateway \
ip: 192.168.1.221/24 --net0 name=eth0,bridge=vmbr0,ip=192.168.1.221/24,gw=192.168.1.1 \
gw: 192.168.1.1 --storage vmsystem \
unprivileged: true --password {{ proxmox_root_password }} \
state: present --unprivileged 1 \
--start 1
args:
executable: /bin/bash
delegate_to: "{{ groups['proxmox_servers'][0] }}"
when: "'221' not in container_check.stdout"
- name: Wait for container to start
wait_for_connection:
host: 192.168.1.221
port: 22
timeout: 60
delay: 5