Files
nixos-infra/scripts/create-lxc.sh
T

54 lines
1.7 KiB
Bash

#!/bin/bash
# Usage: create-lxc.sh --proxmox-server SERVER --user= --identity FIEL [--config-file LXC_CONFIG_FILE]
# Parse command line arguments using docopts
# Connect to Proxmox VE server using provided credentials
# Create LXC container with provided configuration
# Configuration can be provided via stdin or a file
# Fail if both stdin and file are provided
# Example usage:
# cat lxc-config.conf | ./create-lxc.sh --proxmox-server=192.168.1.1 --username=admin --password=password
# or
# ./create-lxc.sh --proxmox-server=192.168.1.1 --username=admin --password=password --config-file=lxc-config.conf
# Example lxc-config.conf:
# lxc.network.type: veth
# lxc.network.link: eth0
# lxc.network.flags: up
# lxc.network.hwaddr: 00:16:3e:xx:xx:xx
# lxc.network.ipv4: 192.168.1.100/24
# lxc.network.ipv4.gateway: 192.168.1.1
# lxc.network.ipv6: 2001:db8::100/64
# lxc.network.ipv6.gateway: 2001:db8::1
# Parse command line arguments using docopts
# Connect to Proxmox VE server using provided credentials
# Create LXC container with provided configuration
# Configuration can be provided via stdin or a file
# Fail if both stdin and file are provided
# Example usage:
# cat lxc-config.conf | ./create-lxc.sh --proxmox-server=192.168.1.1 --username=admin --password=password
# or
# ./create-lxc.sh --proxmox-server=192.168.1.1 --username=admin --password=password --config-file=lxc-config.conf
# Example lxc-config.conf:
# lxc.network.type: veth
# lxc.network.link: eth0
# lxc.network.flags: up
# lxc.network.hwaddr: 00:16:3e:xx:xx:xx
# lxc.network.ipv4: 192.168.1.100/24
# lxc.network.ipv4.gateway: 192.168.1.1
# lxc.network.ipv6: 2001:db8::100/64
# lxc.network.ipv6.gateway: 2001:db8::1