Merge pull request #2 from ajschroeder/develop

Add OpenSUSE support and fix CentOS storage templates
This commit is contained in:
TheHitman1977
2024-01-17 09:18:15 -06:00
committed by GitHub
17 changed files with 1713 additions and 113 deletions

View File

@@ -29,6 +29,7 @@ The following builds are available:
| CentOS Stream | 8 | | CentOS Stream | 8 |
| Debian | 12 | | Debian | 12 |
| Debian | 11 | | Debian | 11 |
| OpenSUSE Leap | 15.5 |
| Ubuntu Server | 22.04 LTS | | Ubuntu Server | 22.04 LTS |
| Ubuntu Server | 20.04 LTS | | Ubuntu Server | 20.04 LTS |
@@ -694,6 +695,7 @@ vm_disk_lvm = [
## CentOS Stream 8 ## CentOS Stream 8
- Anaconda will stop the install with a message complaining about not enough disk space. This is a known issue with kickstart on RHEL 8, however none of the fixes that have been tried have worked. If you want to build a CentOS-Stream-8 template, you will need to access the console of the machine and simply ignore the warning and continue the installation. - Anaconda will stop the install with a message complaining about not enough disk space. This is a known issue with kickstart on RHEL 8, however none of the fixes that have been tried have worked. If you want to build a CentOS-Stream-8 template, you will need to access the console of the machine and simply ignore the warning and continue the installation.
- OpenSUSE does not support custom storage layouts at this time. This is planned for a future release
# Unsupported Features # Unsupported Features
- UEFI firmware - UEFI firmware

View File

@@ -1,10 +1,19 @@
--- ---
- name: "Prepare the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml" include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Debian'" when: "ansible_facts['distribution'] == 'Debian'"
- name: "Prepare the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml" include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Ubuntu'" when: "ansible_facts['distribution'] == 'Ubuntu'"
- name: "Prepare the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: redhat.yml include_tasks: redhat.yml
when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']" when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']"
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Suse'"
...

View File

@@ -0,0 +1,9 @@
---
- name: Updating the operating system
ansible.builtin.zypper:
name: "*"
state: latest
update_cache: true
...

View File

@@ -1,10 +1,19 @@
--- ---
- name: "Clean the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml" include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Debian'" when: "ansible_facts['distribution'] == 'Debian'"
- name: "Clean the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml" include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Ubuntu'" when: "ansible_facts['distribution'] == 'Ubuntu'"
- name: "Clean the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: redhat.yml include_tasks: redhat.yml
when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']" when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']"
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Suse'"
...

View File

@@ -0,0 +1,80 @@
---
# Tasks to clean the SUSE Customer Center file.
- name: "Cleaning the SUSE Customer Center file."
file:
path: /etc/SUSEConnect
state: absent
# Tasks to clean the audit logs.
- name: "Cleaning the audit logs."
file:
path: "{{ item }}"
state: absent
loop:
- /var/log/audit/audit.log
- /var/log/boot.log
- /var/log/lastlog
- /var/log/mail
- /var/log/messages
- /var/log/secure
- /var/log/warn
- /var/log/wtmp
- /var/log/zypper.log
# Tasks to clean the persistent udev rules.
- name: "Cleaning persistent udev rules."
file:
path: /etc/udev/rules.d/70-persistent-net.rules
state: absent
# Tasks to find the /tmp directories.
- name: "Finding the /tmp directories."
find:
paths:
- /tmp
- /var/tmp
- /var/cache/zypp
file_type: any
register: find_tmp_directories
# Tasks to clean the /tmp directories.
- name: "Cleaning the /tmp directories."
file:
path: "{{ item.path }}"
state: absent
loop: "{{ find_tmp_directories.files }}"
loop_control:
label: "{{ item.path }}"
# Tasks to find the SSH host keys.
- name: "Finding the SSH host keys."
find:
paths: /etc/ssh
patterns: 'ssh_host_*'
register: find_ssh_host_keys
# Tasks to clean the SSH host keys.
- name: "Cleaning the SSH host keys."
file:
path: "{{ item.path }}"
state: absent
loop: "{{ find_ssh_host_keys.files }}"
loop_control:
label: "{{ item.path }}"
# Tasks to clean the machine-id.
- name: "Emptying the /etc/machine-id."
community.general.filesize:
path: /etc/machine-id
size: 0
# Tasks to clean the shell history.
- name: "Cleaning the shell history."
block:
- name: "Cleaning the shell history."
file:
path: "{{ ansible_env.HOME }}/.bash_history"
state: absent
...

View File

@@ -1,10 +1,19 @@
--- ---
- name: "Configure the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml" include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Debian'" when: "ansible_facts['distribution'] == 'Debian'"
- name: "Configure the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml" include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Ubuntu'" when: "ansible_facts['distribution'] == 'Ubuntu'"
- name: "Configure the {{ ansible_facts['distribution'] }} guest operating system."
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: redhat.yml include_tasks: redhat.yml
when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']" when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']"
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Suse'"
...

View File

@@ -0,0 +1,35 @@
---
# Tasks for unregistering from SUSE Customer Center.
- name: "Unregistering from SUSE Customer Center."
command:
cmd: "{{ item }}"
loop:
- SUSEConnect -d
- SUSEConnect --cleanup
# Tasks for configuring SSH for public key authentication.
- name: "Configuring SSH for Public Key Authentication."
block:
- lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PermitRootLogin'
line: 'PermitRootLogin no'
- lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PubkeyAuthentication'
line: 'PubkeyAuthentication yes'
# Tasks for setting the hostname.
- name: "Setting the hostname."
hostname:
name: "localhost"
# Tasks for restarting the SSH daemon.
- name: "Restarting the SSH daemon."
systemd:
name: sshd
state: restarted
daemon_reload: true
...

View File

@@ -1,10 +1,7 @@
--- ---
- name: "Configure users on {{ ansible_facts['distribution'] }} guest operating system."
- name: "{{ task_name }}"
include_tasks: linux.yml include_tasks: linux.yml
when: "ansible_facts['distribution'] == 'Debian'" when: ansible_os_family in ['Debian', 'RedHat', 'Suse']
- name: "Configure users on {{ ansible_facts['distribution'] }} guest operating system."
include_tasks: linux.yml ...
when: "ansible_facts['distribution'] == 'Ubuntu'"
- name: "Configure users on {{ ansible_facts['distribution'] }} guest operating system."
include_tasks: linux.yml
when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']"

249
build.sh
View File

@@ -8,6 +8,193 @@ SCRIPT_PATH=$(realpath "$(dirname "$(follow_link "$0")")")
CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}") CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}")
menu_option_1() { menu_option_1() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/8-stream/
echo -e "\nCONFIRM: Build a CentOS 8 Stream Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a CentOS 8 Stream Template for Proxmox. ###
echo "Building a CentOS 8 Stream Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_2() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/9-stream/
echo -e "\nCONFIRM: Build a CentOS 9 Stream Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a CentOS 9 Stream Template for Proxmox. ###
echo "Building a CentOS 9 Stream Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_3() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/11/
echo -e "\nCONFIRM: Build a Debian 11 (Bullseye) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Debian 11 (Bullseye) for Proxmox. ###
echo "Building a Debian 11 (Bullseye) for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_4() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/12/
echo -e "\nCONFIRM: Build a Debian 12 (Bookworm) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Debian 12 (Bookworm) for Proxmox. ###
echo "Building a Debian 12 (Bookworm) for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_5() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/
echo -e "\nCONFIRM: Build a Ubuntu Server 20.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 20.04 LTS Template for Proxmox. ###
echo "Building a Ubuntu Server 20.04 LTS Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_6() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/
echo -e "\nCONFIRM: Build a Ubuntu Server 20.04 LTS (cloud-init) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 20.04 LTS Template for Proxmox. ###
echo "Building a Ubuntu Server 20.04 LTS (cloud-init) Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var "vm_cloud_init_enable=true" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_7() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/
echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS Template for Proxmox?" echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)" echo -e "\nContinue? (y/n)"
@@ -38,7 +225,7 @@ menu_option_1() {
echo "Done." echo "Done."
} }
menu_option_2() { menu_option_8() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/
echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS (cloud-init) Template for Proxmox?" echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS (cloud-init) Template for Proxmox?"
echo -e "\nContinue? (y/n)" echo -e "\nContinue? (y/n)"
@@ -70,9 +257,9 @@ menu_option_2() {
echo "Done." echo "Done."
} }
menu_option_3() { menu_option_9() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/ INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-5/
echo -e "\nCONFIRM: Build a Ubuntu Server 20.04 LTS Template for Proxmox?" echo -e "\nCONFIRM: Build a OpenSUSE Leap 15.5 Template for Proxmox?"
echo -e "\nContinue? (y/n)" echo -e "\nContinue? (y/n)"
read -r REPLY read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]] if [[ ! $REPLY =~ ^[Yy]$ ]]
@@ -80,8 +267,8 @@ menu_option_3() {
exit 1 exit 1
fi fi
### Build a Ubuntu Server 20.04 LTS Template for Proxmox. ### ### Build a OpenSUSE Leap 15.5 Template for Proxmox. ###
echo "Building a Ubuntu Server 20.04 LTS Template for Proxmox..." echo "Building a OpenSUSE Leap 15.5 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ### ### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..." echo "Initializing HashiCorp Packer and required plugins..."
@@ -101,38 +288,6 @@ menu_option_3() {
echo "Done." echo "Done."
} }
menu_option_4() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/
echo -e "\nCONFIRM: Build a Ubuntu Server 20.04 LTS (cloud-init) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 20.04 LTS Template for Proxmox. ###
echo "Building a Ubuntu Server 20.04 LTS (cloud-init) Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var "vm_cloud_init_enable=true" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
press_enter() { press_enter() {
cd "$SCRIPT_PATH" cd "$SCRIPT_PATH"
echo -n "Press Enter to continue." echo -n "Press Enter to continue."
@@ -165,10 +320,15 @@ until [ "$selection" = "0" ]; do
echo "" echo ""
echo " Linux Distribution:" echo " Linux Distribution:"
echo "" echo ""
echo " 1 - Ubuntu Server 22.04 LTS" echo " 1 - CentOS 8 Stream"
echo " 2 - Ubuntu Server 22.04 LTS (cloud-init)" echo " 2 - CentOS 9 Stream"
echo " 3 - Ubuntu Server 20.04 LTS" echo " 3 - Debian 11 (Bullseye)"
echo " 4 - Ubuntu Server 20.04 LTS (cloud-init)" echo " 4 - Debian 12 (Bookworm)"
echo " 5 - Ubuntu Server 20.04 LTS"
echo " 6 - Ubuntu Server 20.04 LTS (cloud-init)"
echo " 7 - Ubuntu Server 22.04 LTS"
echo " 8 - Ubuntu Server 22.04 LTS (cloud-init)"
echo " 9 - OpenSUSE Leap 15.5"
echo "" echo ""
echo " Other:" echo " Other:"
echo "" echo ""
@@ -182,6 +342,11 @@ until [ "$selection" = "0" ]; do
2 ) clear ; menu_option_2 ; press_enter ;; 2 ) clear ; menu_option_2 ; press_enter ;;
3 ) clear ; menu_option_3 ; press_enter ;; 3 ) clear ; menu_option_3 ; press_enter ;;
4 ) clear ; menu_option_4 ; press_enter ;; 4 ) clear ; menu_option_4 ; press_enter ;;
5 ) clear ; menu_option_5 ; press_enter ;;
6 ) clear ; menu_option_6 ; press_enter ;;
7 ) clear ; menu_option_7 ; press_enter ;;
8 ) clear ; menu_option_8 ; press_enter ;;
9 ) clear ; menu_option_9 ; press_enter ;;
[Ii] ) clear ; info ; press_enter ;; [Ii] ) clear ; info ; press_enter ;;
[Qq] ) clear ; exit ;; [Qq] ) clear ; exit ;;
* ) clear ; incorrect_selection ; press_enter ;; * ) clear ; incorrect_selection ; press_enter ;;

View File

@@ -12,55 +12,55 @@ clearpart --all --initlabel
### Modify partition sizes for the virtual machine hardware. ### Modify partition sizes for the virtual machine hardware.
### Create primary system partitions. ### Create primary system partitions.
%{~ if length(partitions) == 1 && partitions[0].name == "autopart" ~} %{ if length(partitions) == 1 && partitions[0].name == "autopart" ~}
%{~ if partitions[0].format.fstype == "lvm" ~} %{ if partitions[0].format.fstype == "lvm" ~}
autopart --type=lvm autopart --type=lvm
%{ endif } %{ endif }
%{~ if partitions[0].format.fstype == "simple" ~} %{ if partitions[0].format.fstype == "simple" ~}
autopart --type=plain autopart --type=plain
%{ endif } %{ endif }
%{~ if partitions[0].format.fstype == "" ~} %{ if partitions[0].format.fstype == "" ~}
autopart --type=plain autopart --type=plain
%{ endif } %{ endif }
%{ else } %{ else }
%{~ for partition in partitions ~} %{ for partition in partitions ~}
%{~ if partition.format.fstype == "swap" ~} %{ if partition.format.fstype == "swap" ~}
part swap --size=${partition.size} part swap --size=${partition.size}
%{~ endif ~} %{ endif ~}
%{~ if partition.mount.path == "/boot/efi" ~} %{ if partition.mount.path == "/boot/efi" ~}
part ${partition.mount.path} --fstype vfat --size=${partition.size} --label=${partition.format.label} part ${partition.mount.path} --fstype vfat --size=${partition.size} --label=${partition.format.label}
%{~ endif ~} %{ endif ~}
%{~ if partition.mount.path != "" ~} %{ if partition.mount.path != "" ~}
part ${partition.mount.path} --fstype ${partition.format.fstype} --size=${partition.size} --label=${partition.format.label} %{~ if partition.mount.options != "" ~}--fsoptions="${partition.mount.options}"%{~ endif ~} part ${partition.mount.path} --fstype ${partition.format.fstype} --size=${partition.size} --label=${partition.format.label} %{~ if partition.mount.options != "" ~}--fsoptions="${partition.mount.options}"%{~ endif ~}
%{~ endif ~} %{ endif ~}
%{~ if partition.volume_group != "" ~} %{ if partition.volume_group != "" ~}
%{~ if partition.size == -1 ~} %{ if partition.size == -1 ~}
part pv.${partition.volume_group} --size=100 --grow part pv.${partition.volume_group} --size=100 --grow
%{~ else ~} %{ else ~}
part pv.${partition.volume_group} --size=${partition.size} part pv.${partition.volume_group} --size=${partition.size}
%{~ endif ~} %{ endif ~}
### Create a logical volume management (LVM) group. ### Create a logical volume management (LVM) group.
### Modify logical volume sizes for the virtual machine hardware. ### Modify logical volume sizes for the virtual machine hardware.
%{~ for index, volume_group in lvm ~} %{ for index, volume_group in lvm ~}
%{~ if partition.volume_group != "" ~} %{ if partition.volume_group != "" ~}
volgroup ${volume_group.name} --pesize=4096 pv.${partition.volume_group} volgroup ${volume_group.name} --pesize=4096 pv.${partition.volume_group}
%{~ endif ~} %{ endif ~}
### Create logical volumes. ### Create logical volumes.
%{~ for partition in volume_group.partitions ~} %{ for partition in volume_group.partitions ~}
%{~ if partition.format.fstype == "swap" ~} %{ if partition.format.fstype == "swap" ~}
logvol swap --fstype ${partition.format.fstype} --name=${partition.name} --vgname=${volume_group.name} --size=${partition.size} --label=${partition.format.label} logvol swap --fstype ${partition.format.fstype} --name=${partition.name} --vgname=${volume_group.name} --size=${partition.size} --label=${partition.format.label}
%{~ else ~} %{ else ~}
logvol ${partition.mount.path} %{ if partition.format.fstype == "fat32" } --fstype vfat %{ else } --fstype ${partition.format.fstype} %{ endif } %{ if partition.size != -1 } --size=${partition.size} %{ else } --size=100 --grow %{ endif } --name=${partition.name} --vgname=${volume_group.name} --label=${partition.format.label} %{ if partition.mount.options != "" ~} --fsoptions="${partition.mount.options}" %{~ endif ~} logvol ${partition.mount.path} %{ if partition.format.fstype == "fat32" } --fstype vfat %{ else } --fstype ${partition.format.fstype} %{ endif } %{ if partition.size != -1 } --size=${partition.size} %{ else } --size=100 --grow %{ endif } --name=${partition.name} --vgname=${volume_group.name} --label=${partition.format.label} %{ if partition.mount.options != "" ~} --fsoptions="${partition.mount.options}" %{~ endif ~}
%{~ endif ~} %{ endif ~}
%{~ endfor ~} %{ endfor ~}
%{~ endfor ~} %{ endfor ~}
%{~ endif ~} %{ endif ~}
%{~ endfor ~} %{ endfor ~}
%{~ endif } %{ endif }

View File

@@ -12,55 +12,55 @@ clearpart --all --initlabel
### Modify partition sizes for the virtual machine hardware. ### Modify partition sizes for the virtual machine hardware.
### Create primary system partitions. ### Create primary system partitions.
%{~ if length(partitions) == 1 && partitions[0].name == "autopart" ~} %{ if length(partitions) == 1 && partitions[0].name == "autopart" ~}
%{~ if partitions[0].format.fstype == "lvm" ~} %{ if partitions[0].format.fstype == "lvm" ~}
autopart --type=lvm autopart --type=lvm
%{ endif } %{ endif }
%{~ if partitions[0].format.fstype == "simple" ~} %{ if partitions[0].format.fstype == "simple" ~}
autopart --type=plain autopart --type=plain
%{ endif } %{ endif }
%{~ if partitions[0].format.fstype == "" ~} %{ if partitions[0].format.fstype == "" ~}
autopart --type=plain autopart --type=plain
%{ endif } %{ endif }
%{ else } %{ else }
%{~ for partition in partitions ~} %{ for partition in partitions ~}
%{~ if partition.format.fstype == "swap" ~} %{ if partition.format.fstype == "swap" ~}
part swap --size=${partition.size} part swap --size=${partition.size}
%{~ endif ~} %{ endif ~}
%{~ if partition.mount.path == "/boot/efi" ~} %{ if partition.mount.path == "/boot/efi" ~}
part ${partition.mount.path} --fstype vfat --size=${partition.size} --label=${partition.format.label} part ${partition.mount.path} --fstype vfat --size=${partition.size} --label=${partition.format.label}
%{~ endif ~} %{ endif ~}
%{~ if partition.mount.path != "" ~} %{ if partition.mount.path != "" ~}
part ${partition.mount.path} --fstype ${partition.format.fstype} --size=${partition.size} --label=${partition.format.label} %{~ if partition.mount.options != "" ~}--fsoptions="${partition.mount.options}"%{~ endif ~} part ${partition.mount.path} --fstype ${partition.format.fstype} --size=${partition.size} --label=${partition.format.label} %{~ if partition.mount.options != "" ~}--fsoptions="${partition.mount.options}"%{~ endif ~}
%{~ endif ~} %{ endif ~}
%{~ if partition.volume_group != "" ~} %{ if partition.volume_group != "" ~}
%{~ if partition.size == -1 ~} %{ if partition.size == -1 ~}
part pv.${partition.volume_group} --size=100 --grow part pv.${partition.volume_group} --size=100 --grow
%{~ else ~} %{ else ~}
part pv.${partition.volume_group} --size=${partition.size} part pv.${partition.volume_group} --size=${partition.size}
%{~ endif ~} %{ endif ~}
### Create a logical volume management (LVM) group. ### Create a logical volume management (LVM) group.
### Modify logical volume sizes for the virtual machine hardware. ### Modify logical volume sizes for the virtual machine hardware.
%{~ for index, volume_group in lvm ~} %{ for index, volume_group in lvm ~}
%{~ if partition.volume_group != "" ~} %{ if partition.volume_group != "" ~}
volgroup ${volume_group.name} --pesize=4096 pv.${partition.volume_group} volgroup ${volume_group.name} --pesize=4096 pv.${partition.volume_group}
%{~ endif ~} %{ endif ~}
### Create logical volumes. ### Create logical volumes.
%{~ for partition in volume_group.partitions ~} %{ for partition in volume_group.partitions ~}
%{~ if partition.format.fstype == "swap" ~} %{ if partition.format.fstype == "swap" ~}
logvol swap --fstype ${partition.format.fstype} --name=${partition.name} --vgname=${volume_group.name} --size=${partition.size} --label=${partition.format.label} logvol swap --fstype ${partition.format.fstype} --name=${partition.name} --vgname=${volume_group.name} --size=${partition.size} --label=${partition.format.label}
%{~ else ~} %{ else ~}
logvol ${partition.mount.path} %{ if partition.format.fstype == "fat32" } --fstype vfat %{ else } --fstype ${partition.format.fstype} %{ endif } %{ if partition.size != -1 } --size=${partition.size} %{ else } --size=100 --grow %{ endif } --name=${partition.name} --vgname=${volume_group.name} --label=${partition.format.label} %{ if partition.mount.options != "" ~} --fsoptions="${partition.mount.options}" %{~ endif ~} logvol ${partition.mount.path} %{ if partition.format.fstype == "fat32" } --fstype vfat %{ else } --fstype ${partition.format.fstype} %{ endif } %{ if partition.size != -1 } --size=${partition.size} %{ else } --size=100 --grow %{ endif } --name=${partition.name} --vgname=${volume_group.name} --label=${partition.format.label} %{ if partition.mount.options != "" ~} --fsoptions="${partition.mount.options}" %{~ endif ~}
%{~ endif ~} %{ endif ~}
%{~ endfor ~} %{ endfor ~}
%{~ endfor ~} %{ endfor ~}
%{~ endif ~} %{ endif ~}
%{~ endfor ~} %{ endfor ~}
%{~ endif } %{ endif }

View File

@@ -0,0 +1,625 @@
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<add-on t="map">
<add_on_others t="list">
<listentry t="map">
<alias>repo-backports-update</alias>
<media_url>http://download.opensuse.org/update/leap/15.5/backports/</media_url>
<name>Update repository of openSUSE Backports</name>
<priority t="integer">99</priority>
<product_dir>/</product_dir>
</listentry>
<listentry t="map">
<alias>repo-non-oss</alias>
<media_url>http://download.opensuse.org/distribution/leap/15.5/repo/non-oss/</media_url>
<name>Non-OSS Repository</name>
<priority t="integer">99</priority>
<product_dir>/</product_dir>
</listentry>
<listentry t="map">
<alias>repo-openh264</alias>
<media_url>http://codecs.opensuse.org/openh264/openSUSE_Leap/</media_url>
<name>Open H.264 Codec (openSUSE Leap)</name>
<priority t="integer">99</priority>
<product_dir/>
</listentry>
<listentry t="map">
<alias>repo-sle-update</alias>
<media_url>http://download.opensuse.org/update/leap/15.5/sle/</media_url>
<name>Update repository with updates from SUSE Linux Enterprise 15</name>
<priority t="integer">99</priority>
<product_dir>/</product_dir>
</listentry>
<listentry t="map">
<alias>repo-update</alias>
<media_url>http://download.opensuse.org/update/leap/15.5/oss</media_url>
<name>Main Update Repository</name>
<priority t="integer">99</priority>
<product_dir>/</product_dir>
</listentry>
<listentry t="map">
<alias>repo-update-non-oss</alias>
<media_url>http://download.opensuse.org/update/leap/15.5/non-oss/</media_url>
<name>Update Repository (Non-Oss)</name>
<priority t="integer">99</priority>
<product_dir>/</product_dir>
</listentry>
</add_on_others>
</add-on>
<bootloader t="map">
<global t="map">
<append>splash=silent preempt=full mitigations=auto quiet security=apparmor</append>
<cpu_mitigations>auto</cpu_mitigations>
<gfxmode>auto</gfxmode>
<hiddenmenu>false</hiddenmenu>
<os_prober>true</os_prober>
<secure_boot>true</secure_boot>
<terminal>gfxterm</terminal>
<timeout t="integer">8</timeout>
<trusted_grub>false</trusted_grub>
<update_nvram>true</update_nvram>
<xen_kernel_append>vga=gfx-1024x768x16</xen_kernel_append>
</global>
<loader_type>grub2</loader_type>
</bootloader>
<kdump>
<add_crash_kernel config:type="boolean">false</add_crash_kernel>
</kdump>
<firewall t="map">
<default_zone>public</default_zone>
<enable_firewall t="boolean">true</enable_firewall>
<log_denied_packets>off</log_denied_packets>
<start_firewall t="boolean">true</start_firewall>
<zones t="list">
<zone t="map">
<description>Unsolicited incoming network packets are rejected. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>block</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list"/>
<short>Block</short>
<target>%%REJECT%%</target>
</zone>
<zone t="map">
<description>For computers in your demilitarized zone that are publicly-accessible with limited access to your internal network. Only selected incoming connections are accepted.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>dmz</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list">
<service>ssh</service>
</services>
<short>DMZ</short>
<target>default</target>
</zone>
<zone t="map">
<description>All network connections are accepted.</description>
<interfaces t="list">
<interface>docker0</interface>
</interfaces>
<masquerade t="boolean">false</masquerade>
<name>docker</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list"/>
<short>docker</short>
<target>ACCEPT</target>
</zone>
<zone t="map">
<description>Unsolicited incoming network packets are dropped. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>drop</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list"/>
<short>Drop</short>
<target>DROP</target>
</zone>
<zone t="map">
<description>For use on external networks. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<interfaces t="list"/>
<masquerade t="boolean">true</masquerade>
<name>external</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list">
<service>ssh</service>
</services>
<short>External</short>
<target>default</target>
</zone>
<zone t="map">
<description>For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>home</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list">
<service>dhcpv6-client</service>
<service>mdns</service>
<service>samba-client</service>
<service>ssh</service>
</services>
<short>Home</short>
<target>default</target>
</zone>
<zone t="map">
<description>For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>internal</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list">
<service>dhcpv6-client</service>
<service>mdns</service>
<service>samba-client</service>
<service>ssh</service>
</services>
<short>Internal</short>
<target>default</target>
</zone>
<zone t="map">
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<interfaces t="list">
<interface>eth0</interface>
</interfaces>
<masquerade t="boolean">false</masquerade>
<name>public</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list">
<service>dhcpv6-client</service>
<service>ssh</service>
</services>
<short>Public</short>
<target>default</target>
</zone>
<zone t="map">
<description>All network connections are accepted.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>trusted</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list"/>
<short>Trusted</short>
<target>ACCEPT</target>
</zone>
<zone t="map">
<description>For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<interfaces t="list"/>
<masquerade t="boolean">false</masquerade>
<name>work</name>
<ports t="list"/>
<protocols t="list"/>
<services t="list">
<service>dhcpv6-client</service>
<service>ssh</service>
</services>
<short>Work</short>
<target>default</target>
</zone>
</zones>
</firewall>
<general t="map">
<mode t="map">
<confirm t="boolean">false</confirm>
</mode>
</general>
<groups t="list">
<group t="map">
<gid>100</gid>
<groupname>users</groupname>
<userlist/>
</group>
<group t="map">
<gid>493</gid>
<groupname>utmp</groupname>
<userlist/>
</group>
<group t="map">
<gid>65533</gid>
<groupname>nogroup</groupname>
<userlist/>
</group>
<group t="map">
<gid>71</gid>
<groupname>ntadmin</groupname>
<userlist/>
</group>
<group t="map">
<gid>488</gid>
<groupname>input</groupname>
<userlist/>
</group>
<group t="map">
<gid>491</gid>
<groupname>cdrom</groupname>
<userlist/>
</group>
<group t="map">
<gid>475</gid>
<groupname>polkitd</groupname>
<userlist/>
</group>
<group t="map">
<gid>1</gid>
<groupname>bin</groupname>
<userlist>daemon</userlist>
</group>
<group t="map">
<gid>2</gid>
<groupname>daemon</groupname>
<userlist/>
</group>
<group t="map">
<gid>65534</gid>
<groupname>nobody</groupname>
<userlist/>
</group>
<group t="map">
<gid>36</gid>
<groupname>kvm</groupname>
<userlist/>
</group>
<group t="map">
<gid>59</gid>
<groupname>maildrop</groupname>
<userlist>postfix</userlist>
</group>
<group t="map">
<gid>477</gid>
<groupname>sshd</groupname>
<userlist/>
</group>
<group t="map">
<gid>482</gid>
<groupname>chrony</groupname>
<userlist/>
</group>
<group t="map">
<gid>489</gid>
<groupname>disk</groupname>
<userlist/>
</group>
<group t="map">
<gid>492</gid>
<groupname>audio</groupname>
<userlist/>
</group>
<group t="map">
<gid>494</gid>
<groupname>lock</groupname>
<userlist/>
</group>
<group t="map">
<gid>15</gid>
<groupname>shadow</groupname>
<userlist/>
</group>
<group t="map">
<gid>485</gid>
<groupname>tape</groupname>
<userlist/>
</group>
<group t="map">
<gid>495</gid>
<groupname>kmem</groupname>
<userlist/>
</group>
<group t="map">
<gid>5</gid>
<groupname>tty</groupname>
<userlist/>
</group>
<group t="map">
<gid>480</gid>
<groupname>systemd-network</groupname>
<userlist/>
</group>
<group t="map">
<gid>484</gid>
<groupname>video</groupname>
<userlist/>
</group>
<group t="map">
<gid>499</gid>
<groupname>messagebus</groupname>
<userlist/>
</group>
<group t="map">
<gid>486</gid>
<groupname>sgx</groupname>
<userlist/>
</group>
<group t="map">
<gid>497</gid>
<groupname>lp</groupname>
<userlist/>
</group>
<group t="map">
<gid>487</gid>
<groupname>render</groupname>
<userlist/>
</group>
<group t="map">
<gid>0</gid>
<groupname>root</groupname>
<userlist/>
</group>
<group t="map">
<gid>42</gid>
<groupname>trusted</groupname>
<userlist/>
</group>
<group t="map">
<gid>479</gid>
<groupname>systemd-timesync</groupname>
<userlist/>
</group>
<group t="map">
<gid>481</gid>
<groupname>systemd-journal</groupname>
<userlist/>
</group>
<group t="map">
<gid>51</gid>
<groupname>postfix</groupname>
<userlist/>
</group>
<group t="map">
<gid>490</gid>
<groupname>dialout</groupname>
<userlist/>
</group>
<group t="map">
<gid>483</gid>
<groupname>audit</groupname>
<userlist/>
</group>
<group t="map">
<gid>498</gid>
<groupname>mail</groupname>
<userlist>postfix</userlist>
</group>
<group t="map">
<gid>62</gid>
<groupname>man</groupname>
<userlist/>
</group>
<group t="map">
<gid>496</gid>
<groupname>wheel</groupname>
<userlist/>
</group>
<group t="map">
<gid>478</gid>
<groupname>nscd</groupname>
<userlist/>
</group>
</groups>
<host t="map">
<hosts t="list">
<hosts_entry t="map">
<host_address>127.0.0.1</host_address>
<names t="list">
<name>localhost</name>
</names>
</hosts_entry>
<hosts_entry t="map">
<host_address>::1</host_address>
<names t="list">
<name>localhost ipv6-localhost ipv6-loopback</name>
</names>
</hosts_entry>
<hosts_entry t="map">
<host_address>fe00::0</host_address>
<names t="list">
<name>ipv6-localnet</name>
</names>
</hosts_entry>
<hosts_entry t="map">
<host_address>ff00::0</host_address>
<names t="list">
<name>ipv6-mcastprefix</name>
</names>
</hosts_entry>
<hosts_entry t="map">
<host_address>ff02::1</host_address>
<names t="list">
<name>ipv6-allnodes</name>
</names>
</hosts_entry>
<hosts_entry t="map">
<host_address>ff02::2</host_address>
<names t="list">
<name>ipv6-allrouters</name>
</names>
</hosts_entry>
<hosts_entry t="map">
<host_address>ff02::3</host_address>
<names t="list">
<name>ipv6-allhosts</name>
</names>
</hosts_entry>
</hosts>
</host>
<networking t="map">
<dhcp_options t="map">
<dhclient_client_id/>
<dhclient_hostname_option>AUTO</dhclient_hostname_option>
</dhcp_options>
<dns t="map">
<dhcp_hostname t="boolean">true</dhcp_hostname>
<hostname>localhost</hostname>
<resolv_conf_policy>auto</resolv_conf_policy>
</dns>
<interfaces t="list">
<interface t="map">
<bootproto>dhcp</bootproto>
<name>eth0</name>
<startmode>auto</startmode>
<zone>public</zone>
</interface>
</interfaces>
<ipv6 t="boolean">true</ipv6>
<keep_install_network t="boolean">true</keep_install_network>
<managed t="boolean">false</managed>
<net-udev t="list">
<rule t="map">
<name>eth0</name>
<rule>ATTR{address}</rule>
<value>bc:24:11:b0:93:4b</value>
</rule>
</net-udev>
<routing t="map">
<ipv4_forward t="boolean">false</ipv4_forward>
<ipv6_forward t="boolean">false</ipv6_forward>
</routing>
</networking>
<ntp-client t="map">
<ntp_policy>auto</ntp_policy>
<ntp_servers t="list"/>
<ntp_sync>systemd</ntp_sync>
</ntp-client>
${storage}
<proxy t="map">
<enabled t="boolean">false</enabled>
</proxy>
<services-manager t="map">
<default_target>multi-user</default_target>
<services t="map">
<enable t="list">
<service>YaST2-Firstboot</service>
<service>YaST2-Second-Stage</service>
<service>apparmor</service>
<service>auditd</service>
<service>klog</service>
<service>chronyd</service>
<service>cron</service>
<service>cups</service>
<service>firewalld</service>
<service>wickedd-auto4</service>
<service>wickedd-dhcp4</service>
<service>wickedd-dhcp6</service>
<service>wickedd-nanny</service>
<service>irqbalance</service>
<service>issue-generator</service>
<service>kbdsettings</service>
<service>lvm2-monitor</service>
<service>mcelog</service>
<service>wicked</service>
<service>nscd</service>
<service>postfix</service>
<service>purge-kernels</service>
<service>rsyslog</service>
<service>smartd</service>
<service>sshd</service>
<service>systemd-fsck-root</service>
<service>systemd-pstore</service>
<service>systemd-remount-fs</service>
<service>qemu-guest-agent</service>
</enable>
</services>
</services-manager>
<software t="map">
<install_recommended t="boolean">true</install_recommended>
<instsource/>
<packages t="list">
<package>wicked</package>
<package>os-prober</package>
<package>openssh</package>
<package>openSUSE-release</package>
<package>lvm2</package>
<package>kexec-tools</package>
<package>grub2</package>
<package>glibc</package>
<package>firewalld</package>
<package>e2fsprogs</package>
<package>chrony</package>
<package>autoyast2</package>
<package>qemu-guest-agent</package>
</packages>
<patterns t="list">
<pattern>apparmor</pattern>
<pattern>base</pattern>
<pattern>documentation</pattern>
<pattern>enhanced_base</pattern>
<pattern>minimal_base</pattern>
<pattern>sw_management</pattern>
<pattern>yast2_basis</pattern>
</patterns>
<products t="list">
<product>Leap</product>
</products>
</software>
<ssh_import t="map">
<copy_config t="boolean">false</copy_config>
<import t="boolean">false</import>
</ssh_import>
<timezone t="map">
<timezone>${vm_os_timezone}</timezone>
</timezone>
<user_defaults t="map">
<expire/>
<group>100</group>
<home>/home</home>
<inactive>-1</inactive>
<shell>/bin/bash</shell>
<umask>022</umask>
</user_defaults>
<users t="list">
<user t="map">
<authorized_keys t="list"/>
<encrypted t="boolean">true</encrypted>
<fullname>Build User</fullname>
<gid>100</gid>
<home>/home/${build_username}</home>
<home_btrfs_subvolume t="boolean">false</home_btrfs_subvolume>
<password_settings t="map">
<expire/>
<flag/>
<inact/>
<max>99999</max>
<min>0</min>
<warn>7</warn>
</password_settings>
<shell>/bin/bash</shell>
<uid>1000</uid>
<user_password>${build_password_encrypted}</user_password>
<username>${build_username}</username>
</user>
</users>
<scripts>
<post-scripts config:type="list">
<script>
<filename>post.sh</filename>
<interpreter>shell</interpreter>
<feedback config:type="boolean">false</feedback>
<source><![CDATA[
#!/bin/sh
usermod -aG wheel ${build_username}
echo '${build_username} ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/${build_username}
sed -i '/NOPASSWD/s/^# //g' /etc/sudoers
]]>
</source>
</script>
</post-scripts>
<init-scripts config:type="list">
<script>
<source><![CDATA[
#!/bin/sh
systemctl enable --now qemu-guest-agent
]]>
</source>
</script>
</init-scripts>
</scripts>
</profile>

View File

@@ -0,0 +1,63 @@
<partitioning t="list">
<drive t="map">
<device>/dev/system</device>
<enable_snapshots t="boolean">false</enable_snapshots>
<partitions t="list">
<partition t="map">
<create t="boolean">true</create>
<filesystem t="symbol">ext4</filesystem>
<format t="boolean">false</format>
<lv_name>root</lv_name>
<mount>/</mount>
<mountby t="symbol">device</mountby>
<pool t="boolean">false</pool>
<resize t="boolean">false</resize>
<size>32199671808</size>
<!--<size>max</size>-->
<stripes t="integer">1</stripes>
<stripesize t="integer">0</stripesize>
</partition>
<partition t="map">
<create t="boolean">true</create>
<filesystem t="symbol">swap</filesystem>
<format t="boolean">false</format>
<lv_name>swap</lv_name>
<mount>swap</mount>
<mountby t="symbol">device</mountby>
<pool t="boolean">false</pool>
<resize t="boolean">false</resize>
<size>2147483648</size>
<!--<size>auto</size>-->
<stripes t="integer">1</stripes>
<stripesize t="integer">0</stripesize>
</partition>
</partitions>
<pesize>4194304</pesize>
<type t="symbol">CT_LVM</type>
</drive>
<drive t="map">
<device>/dev/${device}</device>
<disklabel>gpt</disklabel>
<partitions t="list">
<partition t="map">
<create t="boolean">true</create>
<format t="boolean">false</format>
<partition_id t="integer">263</partition_id>
<partition_nr t="integer">1</partition_nr>
<resize t="boolean">false</resize>
<size>8388608</size>
</partition>
<partition t="map">
<create t="boolean">true</create>
<format t="boolean">false</format>
<lvm_group>system</lvm_group>
<partition_id t="integer">142</partition_id>
<partition_nr t="integer">2</partition_nr>
<resize t="boolean">false</resize>
<size>34350284288</size>
</partition>
</partitions>
<type t="symbol">CT_DISK</type>
<use>all</use>
</drive>
</partitioning>

View File

@@ -0,0 +1,45 @@
/*
DESCRIPTION:
Ubuntu Server 22.04 LTS variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// Guest Operating System Metadata
vm_os_language = "en_US"
vm_os_keyboard = "us"
vm_os_timezone = "UTC"
vm_os_family = "linux"
vm_os_name = "opensuse-leap"
vm_os_version = "15.5"
// Virtual Machine Guest Operating System Setting
vm_os_type = "l26"
// Virtual Machine Hardware Settings
vm_bios = "seabios"
vm_cpu_count = 1
vm_cpu_sockets = 1
vm_cpu_type = "x86-64-v2-AES"
vm_mem_size = 2048
vm_disk_type = "virtio"
vm_disk_size = "32G"
vm_disk_format = "raw"
vm_storage_pool = "vm-data"
vm_disk_controller_type = "virtio-scsi-pci"
vm_network_card_model = "virtio"
vm_bridge_interface = "vmbr0"
vm_vlan_tag = "102"
// Removable Media Settings
iso_path = "iso"
iso_file = "openSUSE-Leap-15.5-DVD-x86_64-Media.iso"
iso_checksum = "file:https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-x86_64-Media.iso.sha256"
// Boot Settings
vm_boot = "order=virtio0;ide2;net0"
vm_boot_wait = "5s"
// EFI Settings
vm_firmware_path = "./OVMF.fd"
vm_efi_storage_pool = "vm-data"
vm_efi_pre_enrolled_keys = false
vm_efi_type = "4m"

View File

@@ -0,0 +1,202 @@
/*
DESCRIPTION:
openSUSE-Leap 15.5 template using the Packer Builder for Proxmox (proxmox-iso).
*/
// BLOCK: packer
// The Packer configuration.
packer {
required_version = ">= 1.9.1"
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
git = {
version = ">= 0.4.2"
source = "github.com/ethanmdavidson/git"
}
proxmox = {
version = ">= 1.1.6"
source = "github.com/hashicorp/proxmox"
}
}
}
// BLOCK: data
// Defines the data sources.
data "git-repository" "cwd" {}
// BLOCK: locals
// Defines the local variables.
locals {
build_by = "Built by: HashiCorp Packer ${packer.version}"
build_date = formatdate("DD-MM-YYYY hh:mm ZZZ", "${timestamp()}" )
build_version = data.git-repository.cwd.head
build_description = "Version: ${local.build_version}\nBuilt on: ${local.build_date}\n${local.build_by}\nCloud-Init: ${var.vm_cloud_init_enable}"
vm_disk_type = var.vm_disk_type == "virtio" ? "vda" : "sda"
manifest_date = formatdate("YYYY-MM-DD hh:mm:ss", timestamp())
manifest_path = "${path.cwd}/manifests/"
manifest_output = "${local.manifest_path}${local.manifest_date}.json"
data_source_content = {
"/autoinst.xml" = templatefile("${abspath(path.root)}/data/autoinst.pkrtpl.hcl", {
build_username = var.build_username
build_password = var.build_password
build_password_encrypted = var.build_password_encrypted
vm_disk_type = local.vm_disk_type
vm_os_language = var.vm_os_language
vm_os_keyboard = var.vm_os_keyboard
vm_os_timezone = var.vm_os_timezone
common_data_source = var.common_data_source
# lvm needs to be here so late commands can access vg names
lvm = var.vm_disk_lvm
storage = templatefile("${abspath(path.root)}/data/storage.pkrtpl.hcl", {
device = var.vm_disk_device
swap = var.vm_disk_use_swap
partitions = var.vm_disk_partitions
lvm = var.vm_disk_lvm
vm_bios = var.vm_bios
})
})
}
data_source_command = var.common_data_source == "http" ? "autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml" : " netsetup=dhcp autoyast=device://sr1/autoinst.xml"
vm_name = "${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}"
vm_bios = var.vm_bios == "ovmf" ? var.vm_firmware_path : null
}
// BLOCK: source
// Defines the builder configuration blocks.
source "proxmox-iso" "linux-opensuse-leap" {
// Proxmox Connection Settings and Credentials
proxmox_url = "https://${var.proxmox_hostname}:8006/api2/json"
username = "${var.proxmox_api_token_id}"
token = "${var.proxmox_api_token_secret}"
insecure_skip_tls_verify = "${var.proxmox_insecure_connection}"
// Proxmox Settings
node = "${var.proxmox_node}"
// Virtual Machine Settings
vm_name = "${local.vm_name}"
bios = "${var.vm_bios}"
sockets = "${var.vm_cpu_sockets}"
cores = "${var.vm_cpu_count}"
cpu_type = "${var.vm_cpu_type}"
memory = "${var.vm_mem_size}"
os = "${var.vm_os_type}"
scsi_controller = "${var.vm_disk_controller_type}"
disks {
disk_size = "${var.vm_disk_size}"
type = "${var.vm_disk_type}"
storage_pool = "${var.vm_storage_pool}"
format = "${var.vm_disk_format}"
}
dynamic "efi_config" {
for_each = var.vm_bios == "ovmf" ? [1] : []
content {
efi_storage_pool = var.vm_bios == "ovmf" ? var.vm_efi_storage_pool : null
efi_type = var.vm_bios == "ovmf" ? var.vm_efi_type : null
pre_enrolled_keys = var.vm_bios == "ovmf" ? var.vm_efi_pre_enrolled_keys : null
}
}
unmount_iso = true
ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}"
ssh_port = "22"
iso_file = "${var.common_iso_storage}:${var.iso_path}/${var.iso_file}"
iso_checksum = "${var.iso_checksum}"
qemu_agent = true
network_adapters {
bridge = "${var.vm_bridge_interface}"
model = "${var.vm_network_card_model}"
vlan_tag = "${var.vm_vlan_tag}"
}
// Removable Media Settings
http_content = "${var.common_data_source}" == "http" ? "${local.data_source_content}" : null
// Boot and Provisioning Settings
http_bind_address = var.common_data_source == "http" ? var.common_http_bind_address : null
http_port_min = var.common_data_source == "http" ? var.common_http_port_min : null
http_port_max = var.common_data_source == "http" ? var.common_http_port_max : null
boot = var.vm_boot
boot_wait = var.vm_boot_wait
boot_command = [
"<esc><enter><wait>",
"linux ",
"biosdevname=0 ",
"net.ifnames=0 ",
"netdevice=eth0 ",
"netsetup=dhcp ",
"lang=en_US ",
"textmode=1 ",
"${local.data_source_command}",
"<enter><wait>",
]
dynamic "additional_iso_files" {
for_each = var.common_data_source == "disk" ? [1] : []
content {
cd_files = var.common_data_source == "disk" ? local.data_source_content : null
cd_label = var.common_data_source == "disk" ? "cidata" : null
iso_storage_pool = var.common_data_source == "disk" ? "local" : null
}
}
template_name = "${local.vm_name}"
template_description = "${local.build_description}"
# VM Cloud Init Settings
cloud_init = var.vm_cloud_init_enable
cloud_init_storage_pool = var.vm_cloud_init_enable == true ? var.vm_storage_pool : null
}
# Build Definition to create the VM Template
build {
sources = ["source.proxmox-iso.linux-opensuse-leap"]
provisioner "ansible" {
playbook_file = "${path.cwd}/ansible/main.yml"
roles_path = "${path.cwd}/ansible/roles"
ansible_env_vars = [
"ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg",
"ANSIBLE_PYTHON_INTERPRETER=/usr/bin/python3"
]
extra_arguments = [
"--extra-vars", "display_skipped_hosts=false",
"--extra-vars", "BUILD_USERNAME=${var.build_username}",
"--extra-vars", "BUILD_SECRET='${var.build_key}'",
"--extra-vars", "ANSIBLE_USERNAME=${var.ansible_username}",
"--extra-vars", "ANSIBLE_SECRET='${var.ansible_key}'",
]
}
post-processor "manifest" {
output = local.manifest_output
strip_path = true
strip_time = true
custom_data = {
ansible_username = "${var.ansible_username}"
build_username = "${var.build_username}"
build_date = "${local.build_date}"
build_version = "${local.build_version}"
common_data_source = "${var.common_data_source}"
vm_cpu_sockets = "${var.vm_cpu_sockets}"
vm_cpu_count = "${var.vm_cpu_count}"
vm_disk_size = "${var.vm_disk_size}"
vm_bios = "${var.vm_bios}"
vm_os_type = "${var.vm_os_type}"
vm_mem_size = "${var.vm_mem_size}"
vm_network_card_model = "${var.vm_network_card_model}"
vm_cloud_init_enable = "${var.vm_cloud_init_enable}"
}
}
}

View File

@@ -0,0 +1,53 @@
/*
DESCRIPTION:
Debian 11 storage variables used by the Packer Plugin for Proxmox (proxmox-iso).
*/
// VM Storage Settings
variable "vm_disk_device" {
type = string
description = "The device for the virtual disk. (e.g. 'sda')"
}
variable "vm_disk_use_swap" {
type = bool
description = "Whether to use a swap partition."
}
variable "vm_disk_partitions" {
type = list(object({
name = string
size = number
format = object({
label = string
fstype = string
})
mount = object({
path = string
options = string
})
volume_group = string
}))
description = "The disk partitions for the virtual disk."
}
variable "vm_disk_lvm" {
type = list(object({
name = string
partitions = list(object({
name = string
size = number
format = object({
label = string
fstype = string
})
mount = object({
path = string
options = string
})
}))
}))
description = "The LVM configuration for the virtual disk."
default = []
}

View File

@@ -0,0 +1,297 @@
/*
DESCRIPTION:
Debian 11 variables using the Packer Builder for Proxmox (proxmox-iso).
*/
// BLOCK: variable
// Defines the input variables.
// Proxmox Credentials
variable "proxmox_hostname" {
type = string
description = "The FQDN or IP address of a Proxmox node. Only one node should be specified in a cluster."
}
variable "proxmox_api_token_id" {
type = string
description = "The token to login to the Proxmox node/cluster. The format is USER@REALM!TOKENID. (e.g. packer@pam!packer_pve_token)"
}
variable "proxmox_api_token_secret" {
type = string
description = "The secret for the API token used to login to the Proxmox API."
# sensitive = true
}
variable "proxmox_insecure_connection" {
description = "true/false to skip Proxmox TLS certificate checks."
type = bool
default = true
}
// Proxmox Settings
variable "proxmox_node" {
type = string
description = "The name of the Proxmox node that Packer will build templates on."
}
// Virtual Machine Settings
variable "vm_os_language" {
type = string
description = "The guest operating system language."
default = "en_US"
}
variable "vm_os_keyboard" {
type = string
description = "The guest operating system keyboard layout."
default = "us"
}
variable "vm_os_timezone" {
type = string
description = "The guest operating system timezone."
default = "UTC"
}
variable "vm_os_family" {
type = string
description = "The guest operating system family. Used for naming. (e.g. 'linux')"
}
variable "vm_os_name" {
type = string
description = "The guest operating system name. Used for naming. (e.g. 'ubuntu')"
}
variable "vm_os_version" {
type = string
description = "The guest operating system version. Used for naming. (e.g. '22-04-lts')"
}
variable "vm_os_type" {
type = string
description = "The guest operating system type. (e.g. 'l26')"
}
variable "vm_bios" {
type = string
description = "The firmware type. Allowed values 'ovmf' or 'seabios'"
default = "OVMF"
validation {
condition = contains(["ovmf", "seabios"], var.vm_bios)
error_message = "The vm_bios value must be 'ovmf' or 'seabios'."
}
}
variable "vm_firmware_path" {
type = string
description = "The firmware file to be used. Needed for EFI"
default = "/usr/share/ovmf/OVMF.fd"
}
variable "vm_efi_storage_pool" {
type = string
description = "Set the UEFI disk storage location. (e.g. 'local-lvm')"
}
variable "vm_efi_type" {
type = string
description = "Specifies the version of the OVMF firmware to be used. (e.g. '4m')"
}
variable "vm_efi_pre_enrolled_keys" {
type = bool
description = "Whether Microsoft Standard Secure Boot keys should be pre-loaded on the EFI disk. (e.g. false)"
}
variable "vm_cpu_count" {
type = number
description = "The number of virtual CPUs. (e.g. '2')"
}
variable "vm_cpu_sockets" {
type = number
description = "The number of virtual CPU sockets. (e.g. '1')"
}
variable "vm_cpu_type" {
type = string
description = "The CPU type to emulate. See the Proxmox API documentation for the complete list of accepted values. For best performance, set this to host. Defaults to kvm64."
}
variable "vm_mem_size" {
type = number
description = "The size for the virtual memory in MB. (e.g. '2048')"
}
variable "vm_disk_controller_type" {
type = string
description = "The SCSI controller model to emulate. (e.g. 'virtio-scsi-pci')"
}
variable "vm_disk_type" {
type = string
description = "The type of disk to emulate. (e.g. 'virtio')"
}
variable "vm_storage_pool" {
type = string
description = "The name of the Proxmox storage pool to store the VM template. (e.g. 'local-lvm')"
}
variable "vm_disk_size" {
type = string
description = "The size for the virtual disk in GB. (e.g. '32G')"
}
variable "vm_disk_format" {
type = string
description = "The format of the file backing the disk. (e.g. 'qcow2')"
}
variable "vm_network_card_model" {
type = string
description = "The model of the virtual network adapter to emulate. (e.g. 'virtio')"
}
variable "vm_bridge_interface" {
type = string
description = "The name of the Proxmox bridge to attach the adapter to."
}
variable "vm_vlan_tag" {
type = string
description = "If the adapter should tag packets, give the VLAN ID. (e.g. '102')"
}
// Cloud-Init Settings
variable "vm_cloud_init_enable" {
type = bool
description = "Enable or disable cloud-init drive in Proxmox. (e.g. false)"
default = false
}
// Removable Media Settings
variable "common_iso_storage" {
type = string
description = "The name of the source Proxmox storage location for ISO images. (e.g. 'local-lvm')"
}
variable "iso_path" {
type = string
description = "The path on the source Proxmox storage location for ISO images. (e.g. 'iso')"
}
variable "iso_file" {
type = string
description = "The file name of the ISO image used by the vendor. (e.g. 'ubuntu-<version>-live-server-amd64.iso')"
}
variable "iso_checksum" {
type = string
description = "The checksum value of the ISO image provided by the vendor."
}
// Boot Settings
variable "common_data_source" {
type = string
description = "The provisioning data source. (e.g. 'http' or 'disk')"
}
variable "common_http_bind_address" {
type = string
description = "Define an IP address on the host to use for the HTTP server."
default = null
}
variable "common_http_port_min" {
type = number
description = "The start of the HTTP port range."
}
variable "common_http_port_max" {
type = number
description = "The end of the HTTP port range."
}
variable "vm_boot" {
type = string
description = "The boot order for virtual machine devices. (e.g. 'order=virtio0;ide2;net0')"
}
variable "vm_boot_wait" {
type = string
description = "The time to wait after booting the initial VM before typing the boot_command (e.g '10s')"
}
variable "common_ip_wait_timeout" {
type = string
description = "Time to wait for guest operating system IP address response."
}
variable "common_shutdown_timeout" {
type = string
description = "Time to wait for guest operating system shutdown."
}
// Communicator Settings and Credentials
variable "build_username" {
type = string
description = "The username to login to the guest operating system. (e.g. 'ubuntu')"
# sensitive = true
}
variable "build_password" {
type = string
description = "The password to login to the guest operating system."
# sensitive = true
}
variable "build_password_encrypted" {
type = string
description = "The encrypted password to login to the guest operating system."
# sensitive = true
}
variable "build_key" {
type = string
description = "The SSH public key to login to the guest operating system."
# sensitive = true
}
variable "timeout" {
description = "not sure why I need so high a timeout but here we are"
default = "90m"
}
// Ansible Credentials
variable "ansible_username" {
type = string
description = "The username for Ansible to login to the guest operating system. (e.g. 'ansible')"
# sensitive = true
}
variable "ansible_key" {
type = string
description = "The public key for Ansible to login to the guest operating system."
# sensitive = true
}
// HCP Packer Settings
variable "common_hcp_packer_registry_enabled" {
type = bool
description = "Enable the HCP Packer registry."
default = false
}