diff --git a/playbooks/create_lxc.yml b/playbooks/create_lxc.yml index 050db12..ebd8ef5 100644 --- a/playbooks/create_lxc.yml +++ b/playbooks/create_lxc.yml @@ -15,6 +15,14 @@ - name: container_id prompt: "Enter the Container ID (VMID) e.g., 105" private: no + - name: container_cores + prompt: "Enter CPU Cores (e.g., 2)" + default: "2" + private: no + - name: container_memory + prompt: "Enter Memory in MB (e.g., 1024)" + default: "256" + private: no tasks: - name: Normalize IP address (append /24 if missing) @@ -36,8 +44,8 @@ password: "{{ ansible_password }}" netif: net0: "name=eth0,gw=10.0.0.1,ip={{ container_ip_cidr }},bridge=vmbr0" - cores: 2 - memory: 1024 + cores: "{{ container_cores }}" + memory: "{{ container_memory }}" swap: 512 state: present unprivileged: yes diff --git a/playbooks/lxc_setup_ubuntu.yml b/playbooks/lxc_setup_ubuntu.yml index 6db9b6a..a997349 100644 --- a/playbooks/lxc_setup_ubuntu.yml +++ b/playbooks/lxc_setup_ubuntu.yml @@ -76,6 +76,6 @@ path: /opt/ansible/inventory/hosts.ini block: | {{ item }} ansible_host={{ hostvars[item]['ansible_host'] }} - insertafter: "[lxc]" + insertafter: "^\\[lxc\\]" marker: "# {mark} ANSIBLE MANAGED BLOCK FOR LXC" loop: "{{ groups['new'] }}" # Loop over all hosts in the 'new' group \ No newline at end of file