Skip to content

Commit

Permalink
Add Makefiles for all images
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrager committed May 20, 2021
1 parent 6b602ee commit b6048b5
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 15 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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 -
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
12 changes: 12 additions & 0 deletions centos6/Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions centos6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions centos7/Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions centos7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions centos8/Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions centos8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions rhel7/Makefile
Original file line number Diff line number Diff line change
@@ -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
13 changes: 10 additions & 3 deletions rhel7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions rhel8/Makefile
Original file line number Diff line number Diff line change
@@ -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
13 changes: 10 additions & 3 deletions rhel8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions vmware-esxi/Makefile
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions vmware-esxi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down

0 comments on commit b6048b5

Please sign in to comment.