diff --git a/Makefile b/Makefile index 7fcfa99b..2e6a395c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ -.PHONY: tar +.PHONY: default tar FULL_NAME := packer-maas-$(shell git describe --dirty) +default: + $(error Change your working directory to the image name you want to build!) + tar: git ls-files --recurse-submodules LICENSE vmware-esxi centos* rhel* | \ tar -cJf $(FULL_NAME).tar.xz --transform="s,^,$(FULL_NAME)/," -T - diff --git a/README.md b/README.md index 7d7f105e..92e803e6 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,21 @@ If you wish to use QEMU's UI also remove "headless": true If you keep "headless": true you can connect using VNC. Packer will output the IP and port to connect to when run. + +## Makefiles + +Each directory contains a Makefile to help build the image with the correct +arguments. The default make target will remove the output-qemu directory and +previously generated image before building the new image. + +The path to the Packer binary can be overridden with the `PACKER` variable: + +``` +$ make PACKER=/home/user/go/bin/packer +``` + +Images which require a user specified ISO can be set with the `ISO` variable: + +``` +$ make ISO=/path/to/iso +``` diff --git a/centos6/Makefile b/centos6/Makefile new file mode 100644 index 00000000..56d4c602 --- /dev/null +++ b/centos6/Makefile @@ -0,0 +1,12 @@ +PACKER ?= packer + +.PHONY: all clean + +all: centos6.tar.gz + +centos6.tar.gz: clean + sudo PACKER_LOG=1 ${PACKER} build centos6.json + reset + +clean: + sudo ${RM} -rf output-qemu centos6.tar.gz diff --git a/centos6/README.md b/centos6/README.md index 870abd52..a5dfcb4b 100644 --- a/centos6/README.md +++ b/centos6/README.md @@ -28,8 +28,15 @@ line starting with url or repo in http/centos6.ks. Alternatively you may set the --mirrorlist values to a local mirror. ## Building an image -Your current working directory must be in packer-maas/centos6, where this file -is located. Once in packer-maas/centos6 you can generate an image with: +You can easily build the image using the Makefile: + +``` +$ make +``` + +Alternatively you can manually run packer. Your current working directory must +be in packer-maas/centos6, where this file is located. Once in +packer-maas/centos6 you can generate an image with: ``` $ sudo PACKER_LOG=1 packer build centos6.json diff --git a/centos7/Makefile b/centos7/Makefile new file mode 100644 index 00000000..09489f51 --- /dev/null +++ b/centos7/Makefile @@ -0,0 +1,12 @@ +PACKER ?= packer + +.PHONY: all clean + +all: centos7.tar.gz + +centos7.tar.gz: clean + sudo PACKER_LOG=1 ${PACKER} build centos7.json + reset + +clean: + sudo ${RM} -rf output-qemu centos7.tar.gz diff --git a/centos7/README.md b/centos7/README.md index df0866e5..c2ced1e7 100644 --- a/centos7/README.md +++ b/centos7/README.md @@ -29,8 +29,15 @@ line starting with url or repo in http/centos7.ks. Alternatively you may set the --mirrorlist values to a local mirror. ## Building an image -Your current working directory must be in packer-maas/centos7, where this file -is located. Once in packer-maas/centos7 you can generate an image with: +You can easily build the image using the Makefile: + +``` +$ make +``` + +Alternatively you can manually run packer. Your current working directory must +be in packer-maas/centos7, where this file is located. Once in +packer-maas/centos7 you can generate an image with: ``` $ sudo PACKER_LOG=1 packer build centos7.json diff --git a/centos8/Makefile b/centos8/Makefile new file mode 100644 index 00000000..b9414563 --- /dev/null +++ b/centos8/Makefile @@ -0,0 +1,12 @@ +PACKER ?= packer + +.PHONY: all clean + +all: centos8.tar.gz + +centos8.tar.gz: clean + sudo PACKER_LOG=1 ${PACKER} build centos8.json + reset + +clean: + sudo ${RM} -rf output-qemu centos8.tar.gz diff --git a/centos8/README.md b/centos8/README.md index a299d038..4ca3b141 100644 --- a/centos8/README.md +++ b/centos8/README.md @@ -32,8 +32,15 @@ line starting with url or repo in http/centos8.ks. Alternatively you may set the --mirrorlist values to a local mirror. ## Building an image -Your current working directory must be in packer-maas/centos8, where this file -is located. Once in packer-maas/centos8 you can generate an image with: +You can easily build the image using the Makefile: + +``` +$ make +``` + +Alternatively you can manually run packer. Your current working directory must +be in packer-maas/centos8, where this file is located. Once in +packer-maas/centos8 you can generate an image with: ``` $ sudo PACKER_LOG=1 packer build centos8.json diff --git a/rhel7/Makefile b/rhel7/Makefile new file mode 100644 index 00000000..6b1f1648 --- /dev/null +++ b/rhel7/Makefile @@ -0,0 +1,13 @@ +PACKER ?= packer +ISO ?= ${RHEL7_ISO_PATH} + +.PHONY: all clean + +all: rhel7.tar.gz + +rhel7.tar.gz: clean + sudo PACKER_LOG=1 ${PACKER} build -var "rhel7_iso_path=${ISO}" rhel7.json + reset + +clean: + sudo ${RM} -rf output-qemu rhel7.tar.gz diff --git a/rhel7/README.md b/rhel7/README.md index c77a2438..1389a7e8 100644 --- a/rhel7/README.md +++ b/rhel7/README.md @@ -26,11 +26,18 @@ http/rhel7.ks. Alternatively you may set the --mirrorlist values to a local mirror. ## Building an image -Your current working directory must be in packer-maas/rhel7, where this file -is located. Once in packer-maas/rhel7 you can generate an image with: +You can easily build the image using the Makefile: ``` -$ sudo PACKER_LOG=1 packer build -var 'rhel7_iso_path=/PATH/TO/rhel-server-7.7-x86_64-dvd.iso' rhel7.json +$ make ISO=/PATH/TO/rhel-server-7.9-x86_64-dvd.iso +``` + +Alternatively you can manually run packer. Your current working directory must +be in packer-maas/rhel7, where this file is located. Once in packer-maas/rhel7 +you can generate an image with: + +``` +$ sudo PACKER_LOG=1 packer build -var 'rhel7_iso_path=/PATH/TO/rhel-server-7.9-x86_64-dvd.iso' rhel7.json ``` Note: rhel7.json is configured to run Packer in headless mode. Only Packer diff --git a/rhel8/Makefile b/rhel8/Makefile new file mode 100644 index 00000000..c48a246f --- /dev/null +++ b/rhel8/Makefile @@ -0,0 +1,13 @@ +PACKER ?= packer +ISO ?= ${RHEL8_ISO_PATH} + +.PHONY: all clean + +all: rhel8.tar.gz + +rhel8.tar.gz: clean + sudo PACKER_LOG=1 ${PACKER} build -var "rhel8_iso_path=${ISO}" rhel8.json + reset + +clean: + sudo ${RM} -rf output-qemu rhel8.tar.gz diff --git a/rhel8/README.md b/rhel8/README.md index 8379092d..6a486ecc 100644 --- a/rhel8/README.md +++ b/rhel8/README.md @@ -26,11 +26,18 @@ http/rhel8.ks. Alternatively you may set the --mirrorlist values to a local mirror. ## Building an image -Your current working directory must be in packer-maas/rhel8, where this file -is located. Once in packer-maas/rhel8 you can generate an image with: +You can easily build the image using the Makefile: ``` -$ sudo PACKER_LOG=1 packer build -var 'rhel8_iso_path=/PATH/TO/rhel-8.1-x86_64-dvd.iso' rhel8.json +$ make ISO=/PATH/TO/rhel-8.3-x86_64-dvd.iso +``` + +Alternatively you can manually run packer. Your current working directory must +be in packer-maas/rhel8, where this file is located. Once in packer-maas/rhel8 +you can generate an image with: + +``` +$ sudo PACKER_LOG=1 packer build -var 'rhel8_iso_path=/PATH/TO/rhel-8.3-x86_64-dvd.iso' rhel8.json ``` Note: rhel8.json is configured to run Packer in headless mode. Only Packer diff --git a/vmware-esxi/Makefile b/vmware-esxi/Makefile new file mode 100644 index 00000000..e8dc4aa9 --- /dev/null +++ b/vmware-esxi/Makefile @@ -0,0 +1,13 @@ +PACKER ?= packer +ISO ?= ${VMWARE_ESXI_ISO_PATH} + +.PHONY: all clean + +all: vmware-esxi.dd.gz + +vmware-esxi.dd.gz: clean + sudo PACKER_LOG=1 ${PACKER} build -var "vmware_esxi_iso_path=${ISO}" vmware-esxi.json + reset + +clean: + sudo ${RM} -rf output-qemu vmware-esxi.dd.gz diff --git a/vmware-esxi/README.md b/vmware-esxi/README.md index 56a9ad66..bda8f1ee 100644 --- a/vmware-esxi/README.md +++ b/vmware-esxi/README.md @@ -17,10 +17,16 @@ * [MAAS](https://maas.io) 2.5 or above, [MAAS](https://maas.io) 2.6 required for storage configuration ## Customizing the Image -The deployment image may be customized by modifying packer-maas/vmware-esxi/http/vmware-esxi-ks.cfg see Installation and Upgrade Scripts in the [VMware ESXi installation and Setup manual](https://docs.vmware.com/en/VMware-vSphere/6.7/vsphere-esxi-67-installation-setup-guide.pdf) for more information. +The deployment image may be customized by modifying packer-maas/vmware-esxi/KS.CFG see Installation and Upgrade Scripts in the [VMware ESXi installation and Setup manual](https://docs.vmware.com/en/VMware-vSphere/6.7/vsphere-esxi-67-installation-setup-guide.pdf) for more information. ## Building an image -Your current working directory must be in packer-maas/vmware-esxi, where this file is located. Once in packer-maas/vmware-esxi you can generate an image with: +You can easily build the image using the Makefile: + +``` +$ make ISO=/path/to/VMware-VMvisor-Installer-6.7.0.update03-14320388.x86_64.iso +``` + +Alternatively you can manually run packer. Your current working directory must be in packer-maas/vmware-esxi, where this file is located. Once in packer-maas/vmware-esxi you can generate an image with: ``` $ sudo PACKER_LOG=1 packer build -var 'vmware_esxi_iso_path=/path/to/VMware-VMvisor-Installer-6.7.0.update03-14320388.x86_64.iso' vmware-esxi.json ```