feat ✨: Add new setup for Proxmox LXC container
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user