feat: Make LXC CPU cores and memory configurable during creation and refine inventory group insertion regex.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user