Skip to content

Commit

Permalink
add debian12
Browse files Browse the repository at this point in the history
  • Loading branch information
goffinet committed Oct 20, 2024
1 parent ab11afa commit ac3fdcf
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 72 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# packer-kvm

Create VM templates with Packer for usage with Libvirt/KVM virtualization : CentOS 9 (Stream), CentOS 10 (Stream), AlmaLinux 9, Focal (Ubuntu 2004), Fedora 40, Jammy (Ubuntu 2204), Noble (Ubuntu 2404).
Create VM templates with Packer for usage with Libvirt/KVM virtualization : CentOS 9 (Stream), CentOS 10 (Stream), AlmaLinux 9, Focal (Ubuntu 2004), Fedora 40, Jammy (Ubuntu 2204), Noble (Ubuntu 2404) Debian 12 (Bookworm).

Only for education and learning purposes. Do not use it in production.

Expand Down Expand Up @@ -123,6 +123,7 @@ Each JSON file is a template for a distribution :
* [ubuntu2004.pkr.hcl](https://github.com/goffinet/packer-kvm/blob/master/ubuntu2004.pkr.hcl)
* [ubuntu2204.pkr.hcl](https://github.com/goffinet/packer-kvm/blob/master/ubuntu2204.pkr.hcl)
* [ubuntu2404.pkr.hcl](https://github.com/goffinet/packer-kvm/blob/master/ubuntu2404.pkr.hcl)
* [debian12.pkr.hcl](https://github.com/goffinet/packer-kvm/blob/master/debian12.pkr.hcl)

For example :

Expand Down Expand Up @@ -177,7 +178,7 @@ I build images for qemu/KVM with this project and I [publish them](http://downlo
- [ubuntu2004.qcow2 (Focal)](http://download.goffinet.org/kvm/ubuntu2004.qcow2) [[md5sum]](http://download.goffinet.org/kvm/ubuntu2004.qcow2.md5sum) [[sha256sum]](http://download.goffinet.org/kvm/ubuntu2004.qcow2.sha256sum)
- [ubuntu2204.qcow2 (Jammy)](http://download.goffinet.org/kvm/ubuntu2204.qcow2) [[md5sum]](http://download.goffinet.org/kvm/ubuntu2204.qcow2.md5sum) [[sha256sum]](http://download.goffinet.org/kvm/ubuntu2204.qcow2.sha256sum)
- [ubuntu2404.qcow2 (Noble)](http://download.goffinet.org/kvm/ubuntu2404.qcow2) [[md5sum]](http://download.goffinet.org/kvm/ubuntu2404.qcow2.md5sum) [[sha256sum]](http://download.goffinet.org/kvm/ubuntu2404.qcow2.sha256sum)

- [debian12.qcow2 (Bookworm)](http://download.goffinet.org/kvm/debian12.qcow2) [[md5sum]](http://download.goffinet.org/kvm/debian12.qcow2.md5sum) [[sha256sum]](http://download.goffinet.org/kvm/debian12.qcow2.sha256sum)

You can easily download them to `/var/lib/libvirt/images` with this script :

Expand Down Expand Up @@ -218,7 +219,7 @@ This is always beter to know how Libvirt is working. Can you read fundamentals a
```
```raw
Please provide the image name :
almalinux9 centos9 centos10 fedora40 ubuntu2004 ubuntu2204 ubuntu2404
almalinux9 centos9 centos10 debian12 fedora40 ubuntu2004 ubuntu2204 ubuntu2404
```

3. Launch two new machines
Expand Down
2 changes: 1 addition & 1 deletion debian12.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packer {

variable "config_file" {
type = string
default = "user-data"
default = "debian12-preseed.cfg"
}

variable "cpu" {
Expand Down
File renamed without changes.
Empty file removed http/debian12/meta-data
Empty file.
36 changes: 0 additions & 36 deletions http/debian12/user-data

This file was deleted.

2 changes: 1 addition & 1 deletion imagename
Original file line number Diff line number Diff line change
@@ -1 +1 @@
almalinux9 centos9 centos10 fedora40 ubuntu2004 ubuntu2204 ubuntu2404
almalinux9 centos9 centos10 debian12 fedora40 ubuntu2004 ubuntu2204 ubuntu2404
31 changes: 1 addition & 30 deletions roles/build_packer_templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ This role supports the following operating system versions for building Packer t

- **Debian-based Systems:**
- Ubuntu: 20.04, 22.04, 24.04
- Debian: 12

## Example Playbook

Expand All @@ -83,42 +84,12 @@ This role supports the following operating system versions for building Packer t
iso_url: "https://repo.almalinux.org/almalinux/9.4/isos/x86_64"
iso_name: "AlmaLinux-9.4-x86_64-boot.iso"
checksum_filename: "CHECKSUM"
- type: "redhat"
flavor: "centos"
version: "9"
iso_url: "https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso"
iso_name: "CentOS-Stream-9-20241016.0-x86_64-boot.iso"
checksum_filename: "SHA256SUM"
- type: "redhat"
flavor: "centos"
version: "10"
iso_url: "https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/iso"
iso_name: "CentOS-Stream-10-20241018.0-x86_64-boot.iso"
checksum_filename: "SHA256SUM"
- type: "redhat"
flavor: "fedora"
version: "40"
iso_url: "https://fedora.cu.be/linux/releases/40/Server/x86_64/iso"
iso_name: "Fedora-Server-netinst-x86_64-40-1.14.iso"
checksum_filename: "Fedora-Server-40-1.14-x86_64-CHECKSUM"
- type: "debian"
flavor: "ubuntu"
version: "20.04"
iso_url: "http://releases.ubuntu.com/20.04"
iso_name: "ubuntu-20.04.6-live-server-amd64.iso"
checksum_filename: "SHA256SUMS"
- type: "debian"
flavor: "ubuntu"
version: "22.04"
iso_url: "http://releases.ubuntu.com/22.04"
iso_name: "ubuntu-22.04.5-live-server-amd64.iso"
checksum_filename: "SHA256SUMS"
- type: "debian"
flavor: "ubuntu"
version: "24.04"
iso_url: "http://releases.ubuntu.com/24.04"
iso_name: "ubuntu-24.04.1-live-server-amd64.iso"
checksum_filename: "SHA256SUMS"
roles:
- name: Create packer-templates
role: build_packer_templates
Expand Down
13 changes: 12 additions & 1 deletion roles/build_packer_templates/tasks/debian.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: Set debian computed variables
- name: Set debian type computed variables
ansible.legacy.set_fact:
type: "{{ item.type }}"
flavor: "{{ item.flavor }}"
Expand All @@ -20,6 +20,12 @@
ansible.legacy.set_fact:
config_file: "user-data"
metadata_file: "meta-data"
when: item.flavor == "ubuntu"

- name: Set debian flavor config_file
ansible.legacy.set_fact:
config_file: "{{ label }}{{ preseed_suffix }}"
when: item.flavor == "debian"

- name: Create image.pkr.hcl
ansible.legacy.template:
Expand All @@ -30,24 +36,29 @@
ansible.legacy.file:
dest: "{{ playbook_dir }}/http/{{ label }}"
state: directory
when: item.flavor == "ubuntu"

- name: Create debian user-data file
ansible.legacy.template:
src: "{{ config_file }}.j2"
dest: "{{ playbook_dir }}/http/{{ label }}/{{ config_file }}"
when: item.flavor == "ubuntu"

- name: Create debian meta-data file
ansible.legacy.template:
src: "{{ metadata_file }}.j2"
dest: "{{ playbook_dir }}/http/{{ label }}/{{ metadata_file }}"
when: item.flavor == "ubuntu"

- name: Create debian flavor http directory
ansible.legacy.file:
dest: "{{ playbook_dir }}/http"
state: directory
when: item.flavor == "debian"

- name: Create debian flavor preseed file
ansible.legacy.template:
src: "preseed.cfg.j2"
dest: "{{ playbook_dir }}/http/{{ config_file }}"
when: item.flavor == "debian"

0 comments on commit ac3fdcf

Please sign in to comment.