chore 📦: Update LXC container setup in setupacdc.yml

Updated the LXC container setup to include additional configuration options such as swap size and description, while maintaining compatibility with existing configurations.
This commit is contained in:
2025-11-02 08:20:59 +01:00
parent e2621ec2c0
commit e0fc967441

View File

@@ -12,14 +12,17 @@
container_id: 200 container_id: 200
container_template: /var/lib/vz/template/cache/debian-13-standard_13.1-1_amd64.tar.zst container_template: /var/lib/vz/template/cache/debian-13-standard_13.1-1_amd64.tar.zst
container_ostype: debian
container_hostname: "{{ addc_hostname }}" container_hostname: "{{ addc_hostname }}"
container_storage: local-lvm container_storage: local-lvm
container_rootfs_size: 8G container_rootfs_size: 8G
container_memory: 1024 container_memory: 1024
container_swap: 256
container_cores: 2 container_cores: 2
container_net: name=eth0,bridge=vmbr0,ip=dhcp container_net: name=eth0,bridge=vmbr0,ip=dhcp
container_features: keyctl=1,nesting=1,mount=cifs container_features: keyctl=1,nesting=1,mount=cifs
container_description: "default lxc"
tasks: tasks:
# - name: Ensure container does not exist # - name: Ensure container does not exist
@@ -38,7 +41,7 @@
--features {{ container_features }} --features {{ container_features }}
--ssh-public-keys /root/.ssh/id_rsa.pub --ssh-public-keys /root/.ssh/id_rsa.pub
args: args:
creates: "/etc/pve/lxc/{{ container_id }}.conf" creates: "/etc/pve/lxc/201.conf"
@@ -46,19 +49,21 @@
- name: Create LXC container using pct command on shell - name: Create LXC container using pct command on shell
ansible.builtin.shell: | ansible.builtin.shell: |
pct create {{ container_id }} {{ container_template }} \ pct create {{ container_id }} {{ container_template }} \
-ostype debian \ -ostype {{ container_ostype }} \
-hostname {{ container_hostname }} \ -hostname {{ container_hostname }} \
-password 123456 \ -password 123456 \
-cores {{ container_cores }} \ -cores {{ container_cores }} \
-memory {{ container_memory }} \ -memory {{ container_memory }} \
-swap 128 \ -swap {{ container_swap }} \
-net0 name=eth0,bridge=vmbr0,ip={{ addc_ansible_host }}/24,gw={{ location_gateway }},hwaddr={{ mac_address }} \ -net0 name=eth0,bridge=vmbr0,ip={{ addc_ansible_host }}/24,gw={{ location_gateway }},hwaddr={{ mac_address }} \
-storage {{ container_storage }} \ -storage {{ container_storage }} \
-description "default lxc" \ -description {{ container_description }} \
-onboot 1 \ -onboot 1 \
-protection 0 \ -protection 0 \
-unprivileged 1 \ -unprivileged 1 \
-tags "ansible_managed,test" \ -tags "ansible_managed,test" \
-features {{ container_features }} -features {{ container_features }}
args:
creates: "/etc/pve/lxc/{{ container_id }}.conf"
# -timezone: {{ localization_timezone }} \ # -timezone: {{ localization_timezone }} \