Consolidate CentOS 7
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
opts: loop
|
opts: loop
|
||||||
|
|
||||||
- name: Install additions
|
- name: Install additions
|
||||||
ansible.builtin.command: /mnt/VBoxLinuxAdditions.run --nox11 2>&1 > /root/vbox_addon_install.log
|
ansible.builtin.shell: /mnt/VBoxLinuxAdditions.run install 2>&1 > /root/vbox_addon_install.log
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: _cmd.rc not in [0, 2]
|
failed_when: _cmd.rc not in [0, 2]
|
||||||
register: _cmd
|
register: _cmd
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
distro = "centos"
|
|
||||||
version = "7"
|
|
||||||
iso = {
|
|
||||||
url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso"
|
|
||||||
checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6"
|
|
||||||
}
|
|
||||||
boot_command = [
|
|
||||||
"<esc><wait>",
|
|
||||||
"linux inst.ks=cdrom:/http/centos/7-x86_64.ks console=ttyS0",
|
|
||||||
"<enter>"
|
|
||||||
]
|
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env xonsh
|
||||||
|
$RAISE_SUBPROC_ERROR = True
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
self = Path(__file__).absolute()
|
||||||
|
base = self.parent.parent.parent.parent
|
||||||
|
source @(base / "test.xsh")
|
||||||
|
|
||||||
|
|
||||||
|
opts = get_parser(sys.argv[1:])
|
||||||
|
|
||||||
|
cd @(str(base))
|
||||||
|
for provider in get_providers():
|
||||||
|
packer build -var-file=@(self.parent / "x86_64.pkrvars.hcl") @(opts["upload"]) -only=@(provider) @(base / "sources")
|
||||||
@@ -1,6 +1,20 @@
|
|||||||
|
distro = "centos"
|
||||||
|
version = "7"
|
||||||
|
iso = {
|
||||||
|
url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso"
|
||||||
|
checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"<esc><wait>",
|
||||||
|
"linux inst.ks=cdrom:/ks.cfg console=tty0",
|
||||||
|
"<enter>"
|
||||||
|
]
|
||||||
|
cd_files = {
|
||||||
|
"ks.cfg" = <<KICKSTART
|
||||||
install
|
install
|
||||||
text
|
text
|
||||||
reboot
|
reboot
|
||||||
|
network --bootproto=dhcp --activate
|
||||||
url --url=http://mirror.centos.org/centos/7/os/x86_64/
|
url --url=http://mirror.centos.org/centos/7/os/x86_64/
|
||||||
repo --name=updates --baseurl=http://mirror.centos.org/centos/7/updates/x86_64/
|
repo --name=updates --baseurl=http://mirror.centos.org/centos/7/updates/x86_64/
|
||||||
lang en_US.UTF-8
|
lang en_US.UTF-8
|
||||||
@@ -50,3 +64,5 @@ ONBOOT="yes"
|
|||||||
TYPE="Ethernet"
|
TYPE="Ethernet"
|
||||||
EOF
|
EOF
|
||||||
%end
|
%end
|
||||||
|
KICKSTART
|
||||||
|
}
|
||||||
@@ -50,8 +50,8 @@ variable "build" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "cd_files" {
|
variable "cd_files" {
|
||||||
type = list(string)
|
type = map(string)
|
||||||
default = []
|
default = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cd_label" {
|
variable "cd_label" {
|
||||||
@@ -59,6 +59,11 @@ variable "cd_label" {
|
|||||||
default = "cidata"
|
default = "cidata"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "http_files" {
|
||||||
|
type = map(string)
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
name = "${var.distro}-${var.version}-${var.arch}"
|
name = "${var.distro}-${var.version}-${var.arch}"
|
||||||
description = templatefile("../README.box.md", {
|
description = templatefile("../README.box.md", {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ source "qemu" "x86_64" {
|
|||||||
]
|
]
|
||||||
accelerator = var.qemu_accelerator
|
accelerator = var.qemu_accelerator
|
||||||
|
|
||||||
http_directory = "http"
|
http_content = var.http_files
|
||||||
cd_files = var.cd_files
|
cd_content = var.cd_files
|
||||||
cd_label = var.cd_label
|
cd_label = var.cd_label
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ source "virtualbox-iso" "x86_64" {
|
|||||||
["modifyvm", "{{ .Name }}", "--uartmode1", "file", "serial-output-virtualbox-${var.arch}-${var.distro}-${var.version}"]
|
["modifyvm", "{{ .Name }}", "--uartmode1", "file", "serial-output-virtualbox-${var.arch}-${var.distro}-${var.version}"]
|
||||||
]
|
]
|
||||||
|
|
||||||
http_directory = "http"
|
http_content = var.http_files
|
||||||
cd_files = [ "http/${var.cd_files_path}" ]
|
cd_content = var.cd_files
|
||||||
|
cd_label = var.cd_label
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,24 @@ def get_builds():
|
|||||||
builds = [str(p.stem).rsplit(".", 1)[0] for p in distros.glob("**/*.pkrvars.hcl")]
|
builds = [str(p.stem).rsplit(".", 1)[0] for p in distros.glob("**/*.pkrvars.hcl")]
|
||||||
return builds
|
return builds
|
||||||
|
|
||||||
|
|
||||||
|
def get_parser(args):
|
||||||
|
parser = argparse.ArgumentParser("Builder")
|
||||||
|
parser.add_argument("--headless", action="store_true")
|
||||||
|
parser.add_argument("--upload", action="store_true")
|
||||||
|
parsed = parser.parse_args(args)
|
||||||
|
opts = {}
|
||||||
|
if parsed.headless:
|
||||||
|
opts["headless"] = "hadless=true"
|
||||||
|
else:
|
||||||
|
opts["headless"] = "headless=false"
|
||||||
|
if parsed.upload:
|
||||||
|
opts["upload"] = ""
|
||||||
|
else:
|
||||||
|
opts["upload"] = "-except=upload"
|
||||||
|
return opts
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Equivalent of `set -e` in Bash
|
# Equivalent of `set -e` in Bash
|
||||||
$RAISE_SUBPROC_ERROR = True
|
$RAISE_SUBPROC_ERROR = True
|
||||||
|
|||||||
Reference in New Issue
Block a user