Untitled

 avatar
unknown
plain_text
2 years ago
974 B
3
Indexable
from proxmoxer import ProxmoxAPI
from proxmoxer import ProxmoxAPI

proxmox_url = 'https://10.221.112.187:8006'
proxmox_user = 'hbr@JNPRLAB'
proxmox_pass= 'Juniper@12345678'
node = 'ltbg-hml-px01'
template = 'centos-7-ZTP_amd64.tar.gz'
container_count = 3  # Number of containers to create

proxmox = ProxmoxAPI(proxmox_url, user=proxmox_user, password =proxmox_pass,verify_ssl=False)

for i in range(container_count):
    container_name = f'scriptcontainer-{i+1}'  # Adjust the naming scheme as per your requirement

    proxmox.nodes(node).lxc.create(
        vmid=None,  # Leave it as None to let Proxmox assign the next available VM ID
        ostemplate=template,
        vmname=container_name,
        storage='local',  # Specify the storage where the container should be created
        memory=512,  # Adjust the memory size as needed
        cores=1,  # Adjust the number of CPU cores as needed
        password='Embe1mpls',  # Set the container's root password
    )