Skip to content

Commit

Permalink
fix image name, use file instead sha256 as checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
goffinet committed Oct 19, 2024
1 parent 4c8f5ce commit 758b1c9
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 61 deletions.
6 changes: 3 additions & 3 deletions almalinux9.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

variable "config_file" {
type = string
Expand Down Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:1e5d7da3d84d5d9a5a1177858a5df21b868390bfccf7f0f419b1e59acc293160"
default = "file:https://repo.almalinux.org/almalinux/9.4/isos/x86_64/CHECKSUM"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "almalinux9"
default = "almalinux"
}

variable "ram" {
Expand Down
6 changes: 3 additions & 3 deletions centos9.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

variable "config_file" {
type = string
Expand Down Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:fe7c98200887342b16d78d6da9a62c7c5f9a81c7d370eb482d419d7a1814f5af"
default = "file:https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/SHA256SUM"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "centos9"
default = "centos"
}

variable "ram" {
Expand Down
6 changes: 3 additions & 3 deletions fedora40.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

variable "config_file" {
type = string
Expand Down Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:1b4f163c55aa9b35bb08f3d465534aa68899a4984b8ba8976b1e7b28297b61fe"
default = "file:https://fedora.cu.be/linux/releases/40/Server/x86_64/iso/Fedora-Server-40-1.14-x86_64-CHECKSUM"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "fedora40"
default = "fedora"
}

variable "ram" {
Expand Down
2 changes: 1 addition & 1 deletion http/almalinux9-kickstart.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

#auth --enableshadow --passalgo=sha512
url --url="https://repo.almalinux.org/almalinux/9.4/BaseOS/x86_64/kickstart/"
Expand Down
2 changes: 1 addition & 1 deletion http/centos9-kickstart.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

#auth --enableshadow --passalgo=sha512
url --url="https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os"
Expand Down
2 changes: 1 addition & 1 deletion http/fedora40-kickstart.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

#auth --enableshadow --passalgo=sha512
url --url="https://fedora.cu.be/linux/releases/40/Server/x86_64/os"
Expand Down
4 changes: 2 additions & 2 deletions http/ubuntu2004/user-data
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu2004
username: ubuntu
password: $6$rounds=4096$dquhStAxB0fpBE4b$QOa/zHjTHPcUekvsDFpDpMHm4jsv3k4Rtbu8tQGMccp4vIXUzHhenXPJkwmPPx7cO56u3IV/mY/4DrPJUmI3v/
password: $6$rounds=4096$UWACohOn3OoJCBbD$K6rkq/CgNnKN71i6FmvNXF4WAjx/iJowFZrqTmq.JdlzXalPfEjaCmv2koyu7KGyG9jssvVfxTCHM.gD6Df9a0
user-data:
disable_root: false
keyboard:
Expand Down
4 changes: 2 additions & 2 deletions http/ubuntu2204/user-data
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu2204
username: ubuntu
password: $6$rounds=4096$vj3Uv6vNw01XcA1z$KGLeMMVM6vNZuh5DAopE6UX3RHekz2vQRi5oMa5GIO1RfTR.etPANPbmRRVQQCoRSRABoL9znyfEMNpRL0G5S.
password: $6$rounds=4096$1UHyrMSltO.9tJR9$.YIvc72TwhqNmish2wlEYC4ZRse5hi4yezGASYYMkqWT8H/lDQ2qdJrFFyaEaIUOF1EJTnkJmabHyQzCS1Smu.
user-data:
disable_root: false
keyboard:
Expand Down
4 changes: 2 additions & 2 deletions http/ubuntu2404/user-data
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu2404
username: ubuntu
password: $6$rounds=4096$gmyKvIukab3W1GuC$JXpIcGn3oNRsCHNYy.h141PlFSLt7fnYyXlxpCTPjzh0KkbSBx00V01j1yk14FAP2MukHYN.tSk0MkgTaO30y/
password: $6$rounds=4096$R4SxKl1uVM4CA6.I$F3/hgIUxihPZnk0cnSwLUAO7hvJj8ZkXWuqG6wpKfv8lgmlpKY99nHgxb6vm6QrYZ2MfbGD91Qiod7qkR/xmS0
user-data:
disable_root: false
keyboard:
Expand Down
18 changes: 2 additions & 16 deletions roles/build-packer-templates/tasks/debian.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
- name: set Ubuntu computed variables
- name: Set Ubuntu computed variables
set_fact:
label: "{{ item.flavor }}{{ item.version.split('.')[0] }}{{ item.version.split('.')[1] }}"
version: "{{ item.version.split('.')[0] }}{{ item.version.split('.')[1] }}"
when: item.flavor == "ubuntu"

- name: set config_file
- name: Set config_file
set_fact:
config_file: "user-data"

- name: Get checksum file
vars:
checksum_url: "{{ item.iso_url }}/{{ item.checksum_filename }}"
iso_name: "{{ item.iso_name | regex_replace('\\.','\\\\.') }}"
shell: curl -k -L -s {{ checksum_url }} | awk '/{{ iso_name }}/ {print $1}'
register: checksum_file

- debug:
var: checksum_file
tags: never

- set_fact:
checksum: "{{ checksum_file.stdout }}"

- name: Create image.pkr.hcl
template:
src: "linux.pkr.hcl.j2"
Expand Down
18 changes: 2 additions & 16 deletions roles/build-packer-templates/tasks/redhat.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
- name: set computed variables
- name: Set computed variables
set_fact:
label: "{{ item.flavor }}{{ item.version.split('.')[0] }}"
version: "{{ item.version.split('.')[0] }}"

- name: set config_file
- name: Set config_file variable
set_fact:
config_file: "{{ label }}-kickstart.cfg"

- name: Get checksum file
vars:
checksum_url: "{{ item.iso_url }}/{{ item.checksum_filename }}"
iso_name: "{{ item.iso_name | regex_replace('\\.','\\\\.') }}"
shell: curl -k -L -s {{ checksum_url }} | awk '/SHA256 \({{ iso_name }}\)/ {print $NF}'
register: checksum_file

- debug:
var: checksum_file
tags: never

- set_fact:
checksum: "{{ checksum_file.stdout }}"

- name: Create image.pkr.hcl
template:
src: "linux.pkr.hcl.j2"
Expand Down
4 changes: 2 additions & 2 deletions roles/build-packer-templates/templates/linux.pkr.hcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:{{ checksum }}"
default = "file:{{ item.iso_url }}/{{ item.checksum_filename }}"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "{{ label }}"
default = "{{ item.flavor }}"
}

variable "ram" {
Expand Down
6 changes: 3 additions & 3 deletions ubuntu2004.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

variable "config_file" {
type = string
Expand Down Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:b8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b"
default = "file:http://releases.ubuntu.com/20.04/SHA256SUMS"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "ubuntu2004"
default = "ubuntu"
}

variable "ram" {
Expand Down
6 changes: 3 additions & 3 deletions ubuntu2204.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

variable "config_file" {
type = string
Expand Down Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:9bc6028870aef3f74f4e16b900008179e78b130e6b0b9a140635434a46aa98b0"
default = "file:http://releases.ubuntu.com/22.04/SHA256SUMS"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "ubuntu2204"
default = "ubuntu"
}

variable "ram" {
Expand Down
6 changes: 3 additions & 3 deletions ubuntu2404.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-18T20:54:32Z
#Generated by packer-kvm/build-packer-templates.yaml at 2024-10-19T06:07:51Z

variable "config_file" {
type = string
Expand Down Expand Up @@ -27,7 +27,7 @@ variable "headless" {

variable "iso_checksum" {
type = string
default = "sha256:e240e4b801f7bb68c20d1356b60968ad0c33a41d00d828e74ceb3364a0317be9"
default = "file:http://releases.ubuntu.com/24.04/SHA256SUMS"
}

variable "iso_url" {
Expand All @@ -37,7 +37,7 @@ variable "iso_url" {

variable "name" {
type = string
default = "ubuntu2404"
default = "ubuntu"
}

variable "ram" {
Expand Down

0 comments on commit 758b1c9

Please sign in to comment.