From a0dc69e9343466d8e31884d7446d15045629f2e6 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 1 Nov 2025 18:47:03 +0100 Subject: [PATCH] =?UTF-8?q?feat=20=E2=9C=A8:=20Add=20new=20setup=20for=20P?= =?UTF-8?q?roxmox=20LXC=20container?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a new setup for creating a Proxmox LXC container using pct command, including hostname, MAC address, IP address and network settings. This setup is designed to work with the existing Ansible playbook. --- tasks/setupacdc.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tasks/setupacdc.yml b/tasks/setupacdc.yml index 9f49aaa..d711f58 100644 --- a/tasks/setupacdc.yml +++ b/tasks/setupacdc.yml @@ -1,5 +1,28 @@ +- hosts: node0 + gather_facts: no + + vars: + addc_hostname: "DC1" + mac_address: "8E:90:31:DE:31:36" + node_ip: "{{ hostvars['node0']['ansible_host'] }}" + + tasks: + + - name: Create LXC container using pct command + shell: | + pct create 200 /var/lib/vz/template/cache/debian-13-standard_13.1-1_amd64.tar.zst \ + -hostname {{ addc_hostname }} \ + -password 123456 \ + -cores 2 \ + -memory 2048 \ + -net0 name=eth0,bridge=vmbr0,ip={{ container_ip }}/24,gw={{ addc_ansible_host }} \ + -rootfs local:1G + become: yes + become_user: root + + - hosts: localhost - gather_facts: yes + gather_facts: no vars: addc_hostname: "DC1" @@ -20,6 +43,7 @@ debug: msg: "The IP address of node0 is {{ node_ip }}" + - name: Create lxc container community.proxmox.proxmox: vmid: 200