packer-builds

Packer Builds for LXC and Libvirt
git clone https://git.in0rdr.ch/packer-builds.git
Log | Files | Refs | README

commit 49117a9da6ffe44c3b72319f02004d40ef9ca4ef
parent 6bf1d71afb482a06c2e639a4e6d882f6f77cdc82
Author: Andreas Gruhler <andreas.gruhler@adfinis-sygroup.ch>
Date:   Fri, 27 Dec 2019 05:52:38 +0000

remove provisioner

Diffstat:
Mcentos8.json | 12+++---------
Dconfig/centos8-ks.cfg | 36------------------------------------
Aconfig/ks.cfg | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dscripts/cloud-config.sh | 17-----------------
Mscripts/post-process.sh | 14+++++++-------
5 files changed, 71 insertions(+), 69 deletions(-)

diff --git a/centos8.json b/centos8.json @@ -38,23 +38,17 @@ "http_directory":"config", "boot_wait": "10s", "boot_command": [ - "<up><tab> ip=dhcp inst.cmdline inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos8-ks.cfg<enter>" + "<up><tab> ip=dhcp inst.cmdline inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg<enter>" ], "ssh_username": "root", - "ssh_timeout": "20m", + "ssh_timeout": "15m", "ssh_password": "root", "unmount_iso": true, - "template_name": "centos-8", + "template_name": "centos8-{{ isotime \"20060102-150405\" }}", "template_description": "CentOS 8, generated on {{ isotime }}" } ], - "provisioners": [ - { - "type": "shell", - "script": "scripts/cloud-config.sh" - } - ], "post-processors": [ { "type": "manifest", diff --git a/config/centos8-ks.cfg b/config/centos8-ks.cfg @@ -1,36 +0,0 @@ -#version=RHEL8 -ignoredisk --only-use=sda -clearpart --none --initlabel -autopart --type=lvm - -cmdline - -# Use network installation -repo --name="AppStream" --baseurl="http://mirror.centos.org/centos/8/AppStream/x86_64/os/" -url --url="http://mirror.centos.org/centos/8/BaseOS/x86_64/os/" - -# Keyboard layouts -keyboard --vckeymap=us --xlayouts='us' -# System language -lang en_US.UTF-8 -# System timezone -timezone Europe/Zurich --isUtc - -# Network information -network --bootproto=dhcp --device=link --ipv6=auto --activate -network --hostname=localhost.localdomain - -# Root password -rootpw root - -# Do not configure the X Window System -skipx -# System services -services --enabled="chronyd" - -reboot - -%packages -@^server-product-environment -kexec-tools -%end diff --git a/config/ks.cfg b/config/ks.cfg @@ -0,0 +1,61 @@ +#version=RHEL8 +ignoredisk --only-use=sda +clearpart --none --initlabel +autopart --type=lvm + +cmdline + +# Use network installation +repo --name="AppStream" --baseurl="http://mirror.centos.org/centos/8/AppStream/x86_64/os/" +url --url="http://mirror.centos.org/centos/8/BaseOS/x86_64/os/" + +# Keyboard layouts +keyboard --vckeymap=us --xlayouts='us' +# System language +lang en_US.UTF-8 +# System timezone +timezone Europe/Zurich --isUtc + +# Network information +network --bootproto=dhcp --device=link --ipv6=auto --activate +network --hostname=localhost.localdomain + +# Root password +rootpw root + +# Do not configure the X Window System +skipx +# System services +services --enabled=sshd,chronyd +firewall --enabled --service=ssh + +reboot + +%packages +@core +@^minimal install +qemu-guest-agent +cloud-init +cloud-utils-growpart +%end + +# once the installation is complete, +# but before the system is rebooted for the first time +%post +# disable cloud-init +#touch /etc/cloud/cloud-init.disabled +# reset cloud-init +rm -rf /var/lib/cloud + +# change cloud-init default user +sed -i \ + -e 's/name: cloud-user/name: centos/' \ + /etc/cloud/cloud.cfg + +# resolve fqdn/hostname to public address +#sed -i \ + -e 's/127.0.0.1 {{fqdn}} {{hostname}}/#127.0.0.1 {{fqdn}} {{hostname}}/' \ + -e 's/::1 {{fqdn}} {{hostname}}/#::1 {{fqdn}} {{hostname}}/' \ + /etc/cloud/templates/hosts.redhat.tmpl +%end + diff --git a/scripts/cloud-config.sh b/scripts/cloud-config.sh @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -#set -o xtrace - -# install cloud-init -yum install -y cloud-init cloud-utils-growpart - -# change cloud-init defaults -sed -i \ - -e 's/name: cloud-user/name: centos/' \ - /etc/cloud/cloud.cfg -#sed -i \ -# -e 's/127.0.0.1 {{fqdn}}/#127.0.0.1 {{fqdn}}/' \ -# -e '/disable_vmware_customization: false/a manage_etc_hosts: false' \ -# /etc/cloud/templates/hosts.redhat.tmpl diff --git a/scripts/post-process.sh b/scripts/post-process.sh @@ -20,14 +20,14 @@ csrftoken=$(echo "$ticket" | jq -r '.data.CSRFPreventionToken' | sed 's/^/CSRFPr # add cloud-init drive curl -s -H "$csrftoken" -XPOST -b "$cookie" \ "$PM_API_URL/nodes/$PM_NODE/qemu/$vmid/config" \ - --data-urlencode scsi1="local-lvm:cloudinit" - -curl -s -XGET -b "$cookie" \ - "$PM_API_URL/nodes/$PM_NODE/qemu/$vmid/config" | jq '.data.scsi1' + --data-urlencode cdrom="local-lvm:cloudinit" +# +# show cloud-init drive +#curl -s -XGET -b "$cookie" \ +# "$PM_API_URL/nodes/$PM_NODE/qemu/$vmid/config" | jq '.data.cdrom' +# # delete cloud-init drive #curl -s -H "$csrftoken" -XPOST -b "$cookie" \ # "$PM_API_URL/nodes/$PM_NODE/qemu/$vmid/config" \ -# --data-urlencode delete="scsi1" -#curl -s -XGET -b "$cookie" \ -# "$PM_API_URL/nodes/$PM_NODE/qemu/$vmid/config" | jq '.data.scsi1' +# --data-urlencode delete="cdrom"