Improve config file method, and begin work on making network configuration less... hackish.
parent
47197f7107
commit
4647fcd2c8
|
@ -0,0 +1,22 @@
|
||||||
|
# Config file
|
||||||
|
# Don't edit this directly unless you really must and don't
|
||||||
|
# keep this tree under git control.
|
||||||
|
# To make changes, put overrides in config.local
|
||||||
|
|
||||||
|
# KVM pool paths
|
||||||
|
POOL=images
|
||||||
|
POOL_PATH=/data/images
|
||||||
|
POOL=${DEF_POOL}
|
||||||
|
POOL_PATH=${DEF_POOL_PATH}
|
||||||
|
|
||||||
|
# vm prefs : specify vm preferences for your guest
|
||||||
|
BACKUP_ISO_FILES=no # yes or no
|
||||||
|
|
||||||
|
net_interface="bridge=${bridge},model=virtio"
|
||||||
|
|
||||||
|
# guest image format: qcow2 or raw
|
||||||
|
FORMAT=raw
|
||||||
|
|
||||||
|
# convert image format : yes or no
|
||||||
|
CONVERT=yes
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
## /network-config
|
||||||
|
---
|
||||||
|
version: 1
|
||||||
|
config:
|
||||||
|
- type: physical
|
||||||
|
name: eth0
|
||||||
|
subnets:
|
||||||
|
- type: dhcp
|
||||||
|
- type: nameserver
|
||||||
|
search: [%%DOMAIN%%]
|
|
@ -0,0 +1,17 @@
|
||||||
|
## /network-config
|
||||||
|
---
|
||||||
|
version: 1
|
||||||
|
config:
|
||||||
|
- type: physical
|
||||||
|
name: eth0
|
||||||
|
subnets:
|
||||||
|
- type: static
|
||||||
|
address: %%IP_ADDRESS%%
|
||||||
|
netmask: %%NETMASK%%
|
||||||
|
routes:
|
||||||
|
- network: 0.0.0.0
|
||||||
|
netmask: 0.0.0.0
|
||||||
|
gateway: %%GATEWAY%%
|
||||||
|
- type: nameserver
|
||||||
|
address: [%%NAME_SERVER%%]
|
||||||
|
search: [%%DOMAIN%%]
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Heavily Modified Script By: Brielle Bruns
|
# Heavily Modified Script By: Brielle Bruns
|
||||||
# Date: 04/11/2018
|
# Date: 05/13/2018
|
||||||
# URL: https://git.sosdg.org/brielle/virt-install-cloud
|
# URL: https://git.sosdg.org/brielle/virt-install-cloud
|
||||||
# Version: 1.0
|
# Version: 1.0
|
||||||
#
|
#
|
||||||
# Originally based on:
|
# Originally based on:
|
||||||
# virt-install-cloud.sh : script to start an OpenStack cloud image on kvm
|
# virt-install-cloud.sh : script to start an OpenStack cloud image on kvm
|
||||||
# version : 1.1.2
|
# version : 1.2
|
||||||
#
|
#
|
||||||
# Author : Claude Durocher
|
# Author : Claude Durocher
|
||||||
# License : GPLv3
|
# License : GPLv3
|
||||||
|
@ -24,6 +24,9 @@ if [[ $USER != "root" ]]; then
|
||||||
echo "This script must be run as root!" && exit 1
|
echo "This script must be run as root!" && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
WORKING_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "${0} Help"
|
echo "${0} Help"
|
||||||
echo -e "\t-h show this help"
|
echo -e "\t-h show this help"
|
||||||
|
@ -33,6 +36,7 @@ usage() {
|
||||||
echo -e "\t-r ram size (in megabytes) *"
|
echo -e "\t-r ram size (in megabytes) *"
|
||||||
echo -e "\t-c number of vcpus"
|
echo -e "\t-c number of vcpus"
|
||||||
echo -e "\t-b bridge to attach to *"
|
echo -e "\t-b bridge to attach to *"
|
||||||
|
echo -e "\t-x network info (ip:netmask:gateway)"
|
||||||
echo -e "\t-i distribution to use (see script for supported options) - default is stretch"
|
echo -e "\t-i distribution to use (see script for supported options) - default is stretch"
|
||||||
echo -e "\t-o OS type and variant (default: generic:generic - also set by distro option when available)"
|
echo -e "\t-o OS type and variant (default: generic:generic - also set by distro option when available)"
|
||||||
}
|
}
|
||||||
|
@ -82,21 +86,16 @@ arch="amd64"
|
||||||
|
|
||||||
source distros
|
source distros
|
||||||
|
|
||||||
|
if [[ -f ${WORKING_DIR}/config ]]; then
|
||||||
|
source ${WORKING_DIR}/config
|
||||||
|
else
|
||||||
|
echo "Error: Missing ${WORKING_DIR}/config !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# kvm defaults pool paths
|
if [[ -f config.local ]]; then
|
||||||
DEF_POOL=images
|
source config.local
|
||||||
DEF_POOL_PATH=/data/images
|
fi
|
||||||
# vm prefs : specify vm preferences for your guest
|
|
||||||
BACKUP_ISO_FILES=no # yes or no
|
|
||||||
|
|
||||||
net_interface="bridge=${bridge},model=virtio"
|
|
||||||
# guest image format: qcow2 or raw
|
|
||||||
FORMAT=raw
|
|
||||||
# convert image format : yes or no
|
|
||||||
CONVERT=yes
|
|
||||||
# kvm pool
|
|
||||||
POOL=images
|
|
||||||
POOL_PATH=/data/images
|
|
||||||
|
|
||||||
sed -e "s/%GUEST_NAME%/${hostname}/" meta-data > output/meta-data
|
sed -e "s/%GUEST_NAME%/${hostname}/" meta-data > output/meta-data
|
||||||
sed -e "s/%FQDN%/${hostname}.${domain}/" user-data > output/user-data
|
sed -e "s/%FQDN%/${hostname}.${domain}/" user-data > output/user-data
|
||||||
|
|
Loading…
Reference in New Issue