Changes LXC deployment role and introduces a new playbook for that

This commit is contained in:
2026-08-09 12:58:32 +05:00
parent ba366a55a2
commit a2a5ba3a5e
3 changed files with 40 additions and 11 deletions
@@ -0,0 +1,48 @@
---
- name: Create a new container with minimal options defining network interface with static ip
become: false
community.proxmox.proxmox:
validate_certs: false
node: proxmox-server
api_user: root@pam
api_host: 192.168.0.2
api_token_id: ansible
api_token_secret: "{{ proxmox_token_secret }}"
cmode: "shell"
password: "{{ lxc_root_password }}"
hostname: "{{ lxc_hostname }}"
ostemplate: 'main:vztmpl/debian-13-golden-image.tar.gz'
memory: 2048
cores: 2
state: present
disk_volume:
# This is minimal requirement for rootfs
# It might be resized later
size: 4 # 4GB rootfs
# We put rootfs on fast local storage (NVMe SSD)
storage: local
pubkey: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/ansible_key.pub') }}"
netif:
net0: "name=eth0,gw=192.168.0.1,ip={{ lxc_ip_address }},bridge=vmbr0"
- name: Make sure the container has started
become: false
community.proxmox.proxmox:
validate_certs: false
node: proxmox-server
api_user: root@pam
api_host: 192.168.0.2
api_token_id: ansible
api_token_secret: "{{ proxmox_token_secret }}"
vmid: 1040
state: started
- name: Sleep for a minute to ensure that ssh is ready
become: false
ansible.builtin.wait_for:
timeout: 60
delegate_to: localhost
changed_when: false