Merge branch 'main' of ssh://git.thehellings.lan:2222/greg/vms

This commit is contained in:
Greg Hellings
2023-12-29 23:40:17 -06:00
111 changed files with 464 additions and 850 deletions
+47 -9
View File
@@ -1,12 +1,25 @@
# vim: set ft=yaml:
stages:
- build
- release
.build:
stage: build
cache:
paths:
- /var/lib/gitlab-runner/.config/packer/plugins/
- key:
files:
- sources/build.pkr.hcl
paths:
- ./packer_config/
- paths:
- packer_cache/*.iso
rules:
- if: $CI_COMMIT_TAG
variables:
EXCEPT: ''
- if: $CI_COMMIT_TAG =~ "/^$/"
variables:
EXCEPT: '-except=upload'
needs:
- pipeline: $PARENT_PIPELINE_ID
job: distros
@@ -17,21 +30,23 @@ stages:
tags:
- ${tag}
variables: &variables
PACKER_LOG: 1
PACKER_CONFIG_DIR: ./packer_config/
PACKER_LOG: 0
COMMAND: >
packer build ${only}
-var-file="${distro}"
-var build=${BUILD}
-var cpus=2
-var memory=4096
-except=upload
${EXCEPT}
sources
before_script:
- packer init sources
- echo $COMMAND
script:
- export EFI_DIR="$(dirname "$(find /nix/store -name OVMF_VARS.fd | head -1)")/"
- echo $COMMAND > build.sh
- bash build.sh
- bash build.sh || exit 1
qemu.amd64:
extends: .build
@@ -50,6 +65,10 @@ virtualbox-iso.amd64:
tag: vbox
parallel:
matrix: []
after_script: |-
if [ "$CI_JOB_STATUS" == "success" ]; then
xonsh test.xsh
fi
hyperv-iso.amd64:
extends: .build
@@ -59,9 +78,28 @@ hyperv-iso.amd64:
tag: hyperv
parallel:
matrix: []
cache:
paths:
- C:\Users\gregh\AppData\Roaming\packer.d\plugins\
script:
- echo $env:COMMAND > build.ps1
- powershell .\build.ps1
- echo 'if (-not $?) { throw "Error in build"}' >> build.ps1
- pwsh .\build.ps1
after_script: |-
if ( "$CI_JOB_STATUS" -eq "success" ) {
xonsh test.xsh
}
"Create release":
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script: echo "Tagging as released"
needs:
- pipeline: $PARENT_PIPELINE_ID
job: distros
artifacts: true
release:
tag_name: '$CI_COMMIT_TAG'
description: >-
Release $CI_COMMIT_TAG, found on [Vagrant Cloud](https://app.vagrantup.com/boxen/)
as version v${BUILD}
+2 -4
View File
@@ -27,7 +27,7 @@ validate:
packer validate -except=upload -var-file=${vars} sources/
done
shell:
shellcheck:
stage: lint
script: |-
shellcheck --version
@@ -35,15 +35,13 @@ shell:
distros:
stage: generate
image: python:3.11
artifacts:
reports:
dotenv: build.env
paths:
- .gitlab-ci-build.yml
script: |-
python3 -m venv venv
source venv/bin/activate
pip install -U xonsh PyYAML
xonsh ./build.xsh -a --list
echo "BUILD=$(date +'%Y.%m.%d.%H')" >> build.env
+1 -1
View File
@@ -3,7 +3,7 @@
* Arch: ${arch}
* Build: ${build}
* Date: ${formatdate("DD MMM YYYY", timestamp())}
* Bugs: [vms](https://github.com/greg-hellings/vms/issues)
* Bugs: [vms](https://src.thehellings.com/greg/vms/-/issues)
A bare-minimum installation of the guest OS.
+10 -1
View File
@@ -1,12 +1,21 @@
Distros:
* Arch -- Done
* NixOS -- Done
* Alpine
* SuSE
* PopOS
* Mint
* Rocky
* Alma
* Oracle
* Gentoo
* Elementary OS
* Manjaro
Providers:
* VMWare -- Done
* Parallels -- Requires money
* Hyper-V
* Hyper-V -- Done
Architecture:
* arm64
+6 -2
View File
@@ -30,9 +30,13 @@ Vagrant.configure("2") do |config|
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
config.vm.provider "libvirt" do |lv|
end
config.vm.provider "hyperv" do |hv|
config.vm.network "private_network", bridge: "packer-amd64"
config.vm.provider "hyperv" do |hv, over|
over.vm.network "private_network", bridge: "packer-amd64"
#config.vm.network "private_network", bridge: "packer-amd64"
end
#
-10
View File
@@ -1,10 +0,0 @@
exclude_paths:
- ../.cache/
- .cache/
# Must not be relatively anchored
- /**/molecule/*/*.yml
skip_list:
- "204"
- yaml
use_default_rules: true
-20
View File
@@ -1,20 +0,0 @@
dependency:
name: galaxy
options:
role-file: ../requirements.yml # relative to the role dir
requirements-file: ../requirements.yml
provisioner:
name: ansible
playbooks: # These paths are relative to scenario dir
prepare: ../shared/prepare.yml
converge: ../shared/playbook.yml
cleanup: ../shared/cleanup.yml
config_options:
defaults:
stdout_callback: yaml
force_color: true
remote_tmp: /tmp/${USER}/ansible
verifier:
name: ansible
additional_files_or_dirs:
- ../../shared/tests # relative to the scenario tests dir
-33
View File
@@ -1,33 +0,0 @@
- name: install guest additions
hosts: default
vars:
ansible_remote_tmp: /tmp
no_touchy:
- NixOS
pre_tasks:
- name: Pause for a moment in case we need cloud-init to finish
ansible.builtin.pause:
seconds: 20
- name: Help with debugging
ansible.builtin.debug:
msg: "Detected distro: {{ ansible_facts['distribution'] }}"
roles:
- role: devroles.system.epel
- role: virtualbox
when:
- packer_builder_type == 'virtualbox-iso'
- role: vmware
when:
- packer_builder_type == 'vmware-iso'
- ansible_facts.distribution not in no_touchy
- role: qemu
when:
- packer_builder_type == 'qemu'
- role: cleanup
when:
- ansible_facts.distribution not in no_touchy
-3
View File
@@ -1,3 +0,0 @@
collections:
- name: devroles.system
version: "3.0.0"
-8
View File
@@ -1,8 +0,0 @@
- name: clean yum history
become: true
ansible.builtin.shell: |-
set -e
yum clean all
yum history new
truncate -c -s 0 /var/log/yum.log
changed_when: false
-12
View File
@@ -1,12 +0,0 @@
- name: remove unnecessesary packages
become: true
ansible.builtin.package:
name:
- make
- perl
- gcc
- kernel-devel
- kernel-headers
- bzip2
- epel-release
state: absent
-5
View File
@@ -1,5 +0,0 @@
- name: clean up Fedora
become: true
ansible.builtin.command: dnf clean all # noqa command-instead-of-module
when: ansible_facts.pkg_mgr not in ['atomic_container']
changed_when: false
-4
View File
@@ -1,4 +0,0 @@
- name: clean apt files
become: true
ansible.builtin.command: apt-get clean # noqa command-instead-of-module
changed_when: false
-8
View File
@@ -1,8 +0,0 @@
- name: cleanup
include_tasks: "{{ distro }}"
loop:
- "{{ role_path }}/tasks/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"
- "{{ role_path }}/tasks/{{ ansible_facts['distribution'] }}.yml"
when: distro is file
loop_control:
loop_var: distro
-16
View File
@@ -1,16 +0,0 @@
- name: load version information
ansible.builtin.include_vars: "{{ item }}"
loop:
- "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml"
when: item is file
- name: modify init file
become: true
ansible.builtin.replace:
path: "{{ init_file }}"
replace: "{{ init_replace }}"
regexp: "{{ init_regexp }}"
when: init_file is defined
-3
View File
@@ -1,3 +0,0 @@
init_file: /etc/sysconfig/init
init_regexp: "^ACTIVE_CONSOLES=.*$"
init_replace: ACTIVE_CONSOLES=/dev/tty1
-3
View File
@@ -1,3 +0,0 @@
init_file: /etc/default/console-setup
init_regexp: '^(ACTIVE_CONSOLES="/dev/tty).*"'
init_replace: \g<1>1"
-6
View File
@@ -1,6 +0,0 @@
- name: Update on Arch
become: true
community.general.pacman:
upgrade: true
update_cache: true
state: latest
@@ -1,7 +0,0 @@
- name: Update atomic things
become: true
ansible.builtin.command: rpm-ostree upgrade
changed_when: false
register: _update_atomic
retries: 3
until: _update_atomic is success
-9
View File
@@ -1,9 +0,0 @@
- name: Update all the things
become: true
ansible.builtin.package: # noqa package-latest
name: "*"
state: latest
update_cache: true
register: _update_all
retries: 3
until: _update_all is success
-25
View File
@@ -1,25 +0,0 @@
- name: Load update sciprt for proper distro
ansible.builtin.include_tasks:
file: "{{ item }}"
with_first_found:
- files:
- "{{ role_path }}/tasks/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml"
- "{{ role_path }}/tasks/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"
- "{{ role_path }}/tasks/{{ ansible_facts['distribution'] }}.yml"
- "{{ role_path }}/tasks/{{ ansible_facts['os_family'] }}.yml"
- "{{ role_path }}/tasks/default.yml"
- name: Reboot, but don't care if it doesn't
block:
- name: Restart the machine
become: true
ansible.builtin.reboot:
failed_when: false # This module is buggy and can't always understand a reboot
- name: Wait for reboot to finish
ansible.builtin.wait_for_connection:
delay: 15
rescue:
- name: Reboot failed? lol
ansible.builtin.debug:
msg: Reboot failed. lol.
-11
View File
@@ -1,11 +0,0 @@
- name: update locale info
become: true
ansible.builtin.shell: |
set -exo pipefail
localedef --list-archive | ( grep -a -v en_US.utf8 || printf '' ) | xargs -r sudo localedef --delete-from-archive
cp /usr/lib/locale/locale-archive{,.tmpl}
build-locale-archive
when: >
( ansible_facts['distribution'] in ['CentOS'] ) and
( ansible_facts['distribution_major_version'] is version('8', '<') )
changed_when: false
-3
View File
@@ -1,3 +0,0 @@
- name: Rebuild nixos
become: true
ansible.builtin.command: nixos-rebuild switch
-43
View File
@@ -1,43 +0,0 @@
- name: Load version information
ansible.builtin.include_vars: "{{ item }}"
loop:
- "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml"
when: item is file
- name: Install qemu-guest-agent
become: true
ansible.builtin.package:
name:
- qemu-guest-agent
state: present
when: ansible_facts.distribution != 'NixOS'
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
- when: ansible_facts.distribution == 'NixOS'
block:
- name: Tell the configuration to pick up guest agent
ansible.builtin.replace:
path: /etc/nixos/configuration.nix
regexp: "\\./hardware-configuration\\.nix"
replace: |
./hardware-configuration.nix
./guest-agent.nix
- name: Create guest additions configuration
ansible.builtin.copy:
dest: /etc/nixos/guest-agent.nix
owner: vagrant
content: |
{...}:
{
services.qemuGuest.enable = true;
}
notify: Rebuild nixos
-65
View File
@@ -1,65 +0,0 @@
- name: load vars, if needed
ansible.builtin.include_vars: "{{ item }}"
loop:
- "{{ role_path }}/vars/default.yml"
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}_{{ ansible_facts.distribution_major_version }}.yml"
when: item is file
- name: remove cloud-init
become: true
ansible.builtin.package:
name: cloud-init
state: absent
when: ansible_facts.pkg_mgr not in ['atomic_container']
- name: create .ssh directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.ssh"
state: directory
mode: "0700"
- name: fetch authorized_keys
ansible.builtin.get_url:
mode: "0600"
dest: "{{ ansible_user_dir }}/.ssh/authorized_keys"
url: https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub
register: _fetch_authorized_keys
retries: 3
until: _fetch_authorized_keys is success
- name: Sudo commands
block:
- name: configure sshd
ansible.builtin.lineinfile:
line: UseDNS no
path: /etc/ssh/sshd_config
- name: check for the sshd_config.d directory
ansible.builtin.stat:
path: /etc/ssh/sshd_config.d
register: _vagrant_sshd_config_d
- name: be sure that sshd is configured properly to accept the pubkey
ansible.builtin.copy:
content: PubkeyAcceptedKeyTypes +ssh-rsa
mode: "0600"
owner: root
group: root
dest: /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
when: _vagrant_sshd_config_d.stat.exists
- name: enable sshd
ansible.builtin.service:
name: "{{ vagrant_ssh_service_name }}"
state: started
enabled: true
# Fedora 31 has a bug in systemd with kernel >= 5.8 that makes us
# unable to determine state of the service. However, if we were able
# to connect to it to run this Ansible, then we clearly are up
# and running and we can safely ignore this error
# noqa ignore-errors
ignore_errors: >-
{{ ansible_facts.distribution == 'Fedora' and
ansible_facts.distribution_major_version == '31' }}
become: true
-1
View File
@@ -1 +0,0 @@
vagrant_ssh_service_name: ssh
-1
View File
@@ -1 +0,0 @@
vagrant_ssh_service_name: sshd
-94
View File
@@ -1,94 +0,0 @@
- name: Load version information
ansible.builtin.include_vars: "{{ item }}"
loop:
- "{{ role_path }}/vars/{{ ansible_facts['os_family'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml"
when: item is file
- when: ansible_facts.distribution != 'NixOS'
block:
- name: Install build deps for virtualbox addons
become: true
ansible.builtin.package:
name: "{{ virtualbox_packages }}"
state: present
update_cache: true
register: _pkg_install
retries: 3
until: _pkg_install is success
- name: Start services
become: true
ansible.builtin.service:
name: "{{ item }}"
state: started
enabled: true
loop: "{{ virtualbox_services }}"
- name: Run commands to install from ISO
when: virtualbox_from_iso
become: true
block:
- name: Mount ISO file
ansible.posix.mount:
fstype: auto
path: /mnt
src: "{{ virtualbox_iso_location }}"
state: mounted
boot: false
opts: loop
- name: Install additions
ansible.builtin.shell: /mnt/VBoxLinuxAdditions.run install 2>&1 > /root/vbox_addon_install.log
changed_when: false
failed_when: _cmd.rc not in [0, 2]
register: _cmd
- name: Unmount ISO file
ansible.posix.mount:
path: /mnt
state: absent
- name: Remove packages
become: true
ansible.builtin.package:
name: "{{ virtualbox_remove_packages | default([]) }}"
state: absent
when: virtualbox_remove_packages
- name: Remove file
ansible.builtin.file:
path: "{{ virtualbox_iso_location }}"
state: absent
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
- when: ansible_facts.distribution == 'NixOS'
block:
- name: Tell the configuration to pick up guest agent
ansible.builtin.replace:
path: /etc/nixos/configuration.nix
regexp: "\\./hardware-configuration\\.nix"
replace: |
./hardware-configuration.nix
./guest-agent.nix
- name: Create guest additions configuration
ansible.builtin.copy:
dest: /etc/nixos/guest-agent.nix
owner: vagrant
content: |
{...}:
{
virtualisation.virtualbox.guest = {
enable = true;
x11 = false;
};
}
notify: Rebuild nixos
@@ -1,6 +0,0 @@
virtualbox_packages:
- virtualbox-guest-utils-nox
virtualbox_services:
- vboxservice
virtualbox_from_iso: false
virtualbox_remove_packages: []
-11
View File
@@ -1,11 +0,0 @@
virtualbox_packages:
- bzip2
- dkms
- kernel-devel
- kernel-headers
- make
- perl
- gcc
virtualbox_services:
- dkms
virtualbox_from_iso: true
-4
View File
@@ -1,4 +0,0 @@
virtualbox_packages:
- linux-image-amd64
virtualbox_services: []
virtualbox_from_iso: false
@@ -1,7 +0,0 @@
virtualbox_packages:
- dkms
- bzip2
- linux-headers-amd64
- make
virtualbox_services: []
virtualbox_from_iso: true
@@ -1,7 +0,0 @@
virtualbox_packages:
- dkms
- bzip2
- linux-headers-amd64
- make
virtualbox_services: []
virtualbox_from_iso: true
-5
View File
@@ -1,5 +0,0 @@
virtualbox_packages:
- virtualbox-guest-additions
virtualbox_services: []
virtualbox_from_iso: false
virtualbox_pre_commands: []
-5
View File
@@ -1,5 +0,0 @@
virtualbox_packages:
- dkms
- virtualbox-guest-dkms
virtualbox_services: []
virtualbox_from_iso: false
@@ -1,8 +0,0 @@
virtualbox_packages:
- virtualbox-guest-utils
- bzip2
- tar
- build-essential
virtualbox_services: []
virtualbox_from_iso: false
virtualbox_remove_packages: []
-1
View File
@@ -1 +0,0 @@
virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso"
@@ -1,6 +0,0 @@
- name: create hgfs dir
become: true
ansible.builtin.file:
state: directory
path: /mnt/hgfs
mode: 0700
-48
View File
@@ -1,48 +0,0 @@
- name: create mount point
become: true
ansible.builtin.file:
path: /mnt/vmware
state: directory
mode: 0700
- name: mount iso file
become: true
ansible.builtin.command: mount -o loop,ro {{ ansible_user_dir }}/linux.iso /mnt/vmware # noqa command-instead-of-module
changed_when: false
- name: create tmp dir
ansible.builtin.file:
path: /tmp/vmware
state: directory
mode: 0700
- name: untar tools
ansible.builtin.command: |
set -ex
tar zxf /mnt/vmware/VMWareTools-*.tar.gz -C /tmp/vmware
sudo /tmp/vmware/vmware-tools-distrib/vmware-install.pl --default --force-install
rm -r /tmp/vmware
sudo umount /mnt/vmware
changed_when: false
- name: remove files
become: true
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /mnt/vmware
- "{{ ansible_user_dir }}/linux.iso"
- name: add content to /etc/vmware-tools/locations
ansible.builtin.blockinfile:
block: |
remove_answer ENABLE_VGAUTH
answer ENABLE_VGAUTH no
remove_answer ENABLE_VMBLOCK
answer ENABLE_VMBLOCK no
- name: finish up installs
become: true
ansible.builtin.command: /usr/bin/vmware-config-tools.pl --default --skip-stop-abort
changed_when: false
-25
View File
@@ -1,25 +0,0 @@
- name: read variables
ansible.builtin.include_vars: "{{ item }}"
loop:
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}.yml"
- "{{ role_path }}/vars/{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
when: item is file
- name: install vmware related packages
become: true
ansible.builtin.package:
name: "{{ vmware_packages }}"
state: present
- name: modern systems
ansible.builtin.import_tasks: has_package.yml
when: >-
ansible_facts.distribution == 'fedora' or
(ansible_facts.distribution == 'debian' and
ansible_facts.distribution_major_version > 8)
- name: legacy builds
ansible.builtin.import_tasks: legacy.yml
when:
- ansible_facts.distribution == 'debian'
- ansible_facts.distribution_major_version <= '8'
-6
View File
@@ -1,6 +0,0 @@
vmware_packages:
- perl
- net-tools
- make
- gcc
- kernel-devel
-4
View File
@@ -1,4 +0,0 @@
vmware_packages:
- perl
- make
- linux-headers-{{ ansible_architecture }}
-2
View File
@@ -1,2 +0,0 @@
vmware_packages:
- open-vm-tools
-18
View File
@@ -1,18 +0,0 @@
extends: default
rules:
line-length:
max: 120
level: warning
document-start:
present: false
level: error
comments:
require-starting-space: false
truthy: disable # user-data files have lots of palces where the correct response is yes/no
ignore: |
.tox
samples/
.cache
plugins/ceph_ansible
View File
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/env xonsh
import argparse
source ./test.xsh
parser = argparse.ArgumentParser("Build all")
parser.add_argument("--provider", choices=get_providers(), default="qemu.amd64")
args = parser.parse_args()
for f in g`distros/**/build.xsh`:
./@(f) --provider @(args.provider)
+2 -2
View File
@@ -2,5 +2,5 @@
virsh -q vol-list default | awk '{print $1}' | xargs -r -L 1 virsh vol-delete --pool default
sudo virsh -q vol-list default | awk '{print $1}' | sudo xargs -r -L 1 virsh vol-delete --pool default
vagrant box list | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider virtualbox --force
vagrant box list | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider libvirt --force
vagrant box list | grep virtualbox | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider virtualbox --force
vagrant box list | grep libvirt | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider libvirt --force
+4 -4
View File
@@ -5,11 +5,11 @@ iso = {
checksum = "477f50617d648e46d6e326549aa56ab92115a29a97f2ca364e944cea06970608"
}
boot_command = [
"<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>",
"<wait60>", # Wait for system to come up?
"curl <wait>-o <wait>/tmp/install.sh <wait>http://{{ .HTTPIP }}<wait>:{{ .HTTPPort }}/install.sh<enter>",
"e<down><down><down><end> net.ifnames=0 biosdevnames=0<f10>",
"<wait30>", # Wait for system to come up?
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait5>",
"/usr/bin/bash <wait>/tmp/install.sh <wait>{{ .HTTPPort }} <wait>{{ .HTTPIP }}<enter>"
"/usr/bin/bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
]
http_directory = "distros/archlinux/rolling/http/"
boot_wait = "10s"
+4 -4
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -ex
disk="${1}"
#disk="${1}"
# Set locale info to reasonable defaults
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
@@ -27,10 +27,10 @@ systemctl enable NetworkManager
# Configure and install grub
sed -i -E -e 's/GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 net.ifnames=0 biosdevnames=0"/' /etc/default/grub
grub-install --target=i386-pc "${disk}"
grub-install --target=x86_64-efi --efi-directory /boot
grub-install --target=x86_64-efi --efi-directory /boot --removable
grub-mkconfig -o /boot/grub/grub.cfg
# Create and configure the vagrant user
groupadd vagrant
useradd vagrant -g vagrant -G wheel -m
@@ -48,4 +48,4 @@ if [ "${virt}" == "microsoft" ]; then
systemctl enable hv_fcopy_daemon
systemctl enable hv_kvp_daemon
systemctl enable hv_vss_daemon
fi
fi
+15 -11
View File
@@ -17,29 +17,33 @@ fi
# The sed bit is just to strip out the extra fluff, like comments
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${disk}
o # create new GPT partition table
g # create new GPT partition table
n # new
p # primary partition
1 # part number
# default partition number
# default start
+512M # size
t # set type
1 # EFI system partition
n # second partition
# default partition number
# start at first free sector
# default to full disk
p # print, for debugging
w # write the partition table and exit
EOF
sleep 10 # Let me at least read it!
#t # set partition type
#1 # on partition 1
#4 # BIOS boot
# Format and mount partitions
mkfs.ext4 "${disk}1"
mkfs.vfat "${disk}1"
mkfs.ext4 "${disk}2"
mount "${disk}1" /mnt
mount "${disk}2" /mnt
mkdir -p /mnt/boot
mount "${disk}1" /mnt/boot
# Bootstrap system
pacstrap -K /mnt base linux nano sudo networkmanager openssh grub python3
pacstrap -K /mnt base linux nano sudo networkmanager openssh grub python3 efibootmgr
genfstab -L /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
# Run stuff in the chroot
curl -o /mnt/in-chroot.sh "http://${host}:${port}/in-chroot.sh"
+4 -3
View File
@@ -19,9 +19,10 @@ iso = {
checksum = "${sha}"
}
boot_command = [
"<up><tab><wait><bs><bs><bs><bs><bs>",
"inst.text inst.ks=cdrom:/ks.cfg console=tty0",
"<enter><wait>"
"<up>e<wait>",
"<down><down><end><wait>",
" inst.text inst.ks=cdrom:/ks.cfg",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = [ "distros/centos-stream/8/disc/*" ]
HERPDERP
+1 -1
View File
@@ -16,7 +16,7 @@ services --enabled=vmtoolsd
bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop"
zerombr
clearpart --all
part / --fstype=xfs --asprimary --size=1024 --grow
autopart --type=plain
user --name=vagrant --plaintext --password=vagrant
+4 -3
View File
@@ -21,9 +21,10 @@ iso = {
checksum = "${sha}"
}
boot_command = [
"<up><tab><wait><bs><bs><bs><bs><bs>",
"inst.text <wait>inst.ks=cdrom:/ks.cfg <wait>console=tty0",
"<enter><wait>"
"<up>e<wait>",
"<down><down><end><wait>",
" inst.text inst.ks=cdrom:/ks.cfg",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = [ "distros/centos-stream/9/disc/*" ]
HERPDERP
+2 -11
View File
@@ -14,18 +14,9 @@ services --enabled=vmtoolsd
# The biosdevname and ifnames options ensure we get "eth0" as our interface
# even in environments like virtualbox that emulate a real NW card
bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop"
clearpart --all
autopart --type=plain
zerombr
%include /tmp/disks.ks
%pre --interpreter /bin/bash --log /tmp/greg
if [ -e /dev/vda ]; then
disk="vda"
else
disk="sda"
fi
echo "clearpart --all --drives=$disk" > /tmp/disks.ks
echo "part / --fstype=ext4 --asprimary --size=1024 --grow --ondisk=$disk" >> /tmp/disks.ks
%end
user --name=vagrant --plaintext --password=vagrant
+4 -3
View File
@@ -5,8 +5,9 @@ iso = {
checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6"
}
boot_command = [
"<up><tab><wait>",
"<bs><bs><bs><bs><bs><wait> inst.ks<wait>=cdrom:/ks.cfg<wait> console<wait>=tty0<wait>",
"<enter>"
"<up>e<wait>",
"<down><down><end><wait>",
" inst.ks=cdrom:/ks.cfg<wait>",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = ["distros/centos/7/disc/*"]
+3 -5
View File
@@ -36,11 +36,9 @@ libselinux-python
%pre
# In Hyper-V this needs a re-do for some reason
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
nmcli c down eth0
nmcli c up eth0
fi
set -ex
nmcli dev connect eth0
nmcli c
%end
%post --erroronfail
+2 -1
View File
@@ -5,4 +5,5 @@
provider: virtualbox-iso
- arch: amd64
provider: vmware-iso
# Hyper-V, I have been thus far unable to have it bring up its network automatically
- arch: amd64
provider: hyperv-iso
+12 -7
View File
@@ -5,12 +5,17 @@ iso = {
checksum = "75aa64071060402a594dcf1e14afd669ca0f8bf757b56d4c9c1a31b8f7c8f931"
}
boot_command = [
"<esc><wait>",
"auto <wait>",
"DEBIAN_FRONTEND=text <wait>",
"preseed/url<wait>=http://{{.HTTPIP}}<wait>:{{ .HTTPPort }}/preseed.cfg <wait>",
"console=tty0 <wait>",
"--- <wait>net.ifnames=0 <wait>biosdevnames=0 <wait>",
"<enter>"
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"auto ",
"preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ",
"ipv6.disable=1 ",
"debian-installer=en_US locale=en_US kbd-chooser/method=us ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"keyboard-configuration/xkb-keymap=us ",
"debconf/frontend=noninteractive ",
"hostname={{.Name}} ",
"domain=vagrant ",
"<f10>"
]
http_directory = "distros/debian/10/http/"
+6 -5
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -ex
apt autoremove -y
# 5 minute way to acquire package lock
apt-get -o DPkg::Lock::Timeout=600 autoremove -y
# Configure sshd to be faster
sed -i -E -e 's,^.*(UseDNS).*$,\1 No,' /etc/ssh/sshd_config
@@ -12,8 +13,8 @@ apt-get clean
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
yum install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
apt-get install -y hyperv-daemons
systemctl enable hyperv-daemons.hv-fcopy-daemon
systemctl enable hyperv-daemons.hv-kvp-daemon
systemctl enable hyperv-daemons.hv-vss-daemon
fi
+21 -23
View File
@@ -11,39 +11,36 @@ d-i passwd/user-password-again password vagrant
d-i time/zone string UTC
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
scheme :: \
200 0 200 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /boot } . \
200% 0 200% linux-swap \
$primary{ } \
method{ swap } \
format{ } . \
1 0 -1 ext4 \
$primary{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } .
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Network settings
d-i netcfg/enable boolean true
d-i netcfg/use_autoconfig boolean true
d-i netcfg/hostname string vagrant
d-i netcfg/domain string vagrant
# Settings for package manager
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false
d-i mirror/country string manual
d-i mirror/http/hostname string httpredir.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
# Package selection
tasksel tasksel/first multiselect
d-i pkgsel/include string curl openssh-server sudo python3 hyperv-daemons
d-i pkgsel/include string curl openssh-server sudo python3 network-manager
popularity-contest popularity-contest/participate boolean false
d-i grub-installer/bootdev string default
d-i grub-installer/force-efi-extra-removable boolean true
d-i finish-install/reboot_in_progress note
@@ -57,4 +54,5 @@ d-i preseed/late_command string
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \
chmod 440 /target/etc/sudoers.d/vagrant; \
in-target apt-get update; \
in-target apt-get upgrade -y
in-target apt-get upgrade -y; \
in-target bash -c 'if [ "$(systemd-detect-virt)" == "microsoft" ]; then apt-get install -y hyperv-daemons; fi'
+12 -7
View File
@@ -5,12 +5,17 @@ iso = {
checksum = "d7a74813a734083df30c8d35784926deaa36bc41e5c0766388e9f591ab056b72"
}
boot_command = [
"<esc><wait>",
"auto <wait>",
"DEBIAN<wait>_FRONTEND<wait>=text <wait>",
"preseed<wait>/url<wait>=http://{{.HTTPIP}}<wait>:{{ .HTTPPort }}<wait>/preseed<wait>.cfg <wait>",
"console<wait>=tty0 <wait>",
"--- <wait>net<wait>.ifnames<wait>=0 <wait>bios<wait>dev<wait>names=0 <wait>",
"<enter>"
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"auto ",
"preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ",
"ipv6.disable=1 ",
"debian-installer=en_US locale=en_US kbd-chooser/method=us ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"keyboard-configuration/xkb-keymap=us ",
"debconf/frontend=noninteractive ",
"hostname={{.Name}} ",
"domain=vagrant ",
"<f10>"
]
http_directory = "distros/debian/11/http/"
+6 -5
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -ex
apt autoremove -y
# 5 minute wait for the lock timeout
apt-get -o DPkg::Lock::Timeout=600 autoremove -y
# Configure sshd to be faster
cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
@@ -14,8 +15,8 @@ apt-get clean
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
yum install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
apt-get install -y hyperv-daemons
systemctl enable hv-fcopy-daemon
systemctl enable hv-kvp-daemon
systemctl enable hv-vss-daemon
fi
+14 -28
View File
@@ -11,39 +11,30 @@ d-i passwd/user-password-again password vagrant
d-i time/zone string UTC
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
scheme :: \
200 0 200 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /boot } . \
200% 0 200% linux-swap \
$primary{ } \
method{ swap } \
format{ } . \
1 0 -1 ext4 \
$primary{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } .
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Settings for package manager
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false
d-i mirror/country string manual
d-i mirror/http/hostname string httpredir.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
# Package selection
tasksel tasksel/first multiselect
d-i pkgsel/include string curl openssh-server sudo python3
d-i pkgsel/include string curl openssh-server sudo python3 network-manager
popularity-contest popularity-contest/participate boolean false
d-i grub-installer/bootdev string default
d-i grub-installer/force-efi-extra-removable boolean true
d-i finish-install/reboot_in_progress note
@@ -58,9 +49,4 @@ d-i preseed/late_command string
chmod 440 /target/etc/sudoers.d/vagrant; \
sed -i -e 's/ens3/ens5/g' /target/etc/network/interfaces; \
in-target apt-get update; \
in-target apt-get upgrade -y
#echo '[Match]' >> /target/etc/systemd/network/dhcp.network; \
#echo 'Name=en*' >> /target/etc/systemd/network/dhcp.network; \
#echo '[Network]' >> /target/etc/systemd/network/dhcp.network; \
#echo 'DHCP=yes' >> /target/etc/systemd/network/dhcp.network; \
in-target apt-get upgrade -y
+12 -7
View File
@@ -5,12 +5,17 @@ iso = {
checksum = "64d727dd5785ae5fcfd3ae8ffbede5f40cca96f1580aaa2820e8b99dae989d94"
}
boot_command = [
"<esc><wait>",
"auto ",
"DEBIAN_FRONTEND=text ",
"preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ",
"console=tty0 ",
"--- net.ifnames=0 biosdevnames=0 <wait>",
"<enter>"
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"auto ",
"preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ",
"ipv6.disable=1 ",
"debian-installer=en_US locale=en_US kbd-chooser/method=us ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"keyboard-configuration/xkb-keymap=us ",
"debconf/frontend=noninteractive ",
"hostname={{.Name}} ",
"domain=vagrant ",
"<f10>"
]
http_directory = "distros/debian/12/http/"
+6 -5
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -ex
apt autoremove -y
# 5 minute timeout for the package lock to arrive
apt-get -o DPkg::Lock::Timeout=600 autoremove -y
# Configure sshd to be faster
cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
@@ -14,8 +15,8 @@ apt-get clean
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
yum install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
apt-get install -y hyperv-daemons
systemctl enable hv-fcopy-daemon
systemctl enable hv-kvp-daemon
systemctl enable hv-vss-daemon
fi
+18 -10
View File
@@ -1,5 +1,3 @@
d-i auto-install/enable boolean true
d-i apt-setup/disable-cdrom-entries boolean true
d-i debian-installer/locale string en_US
d-i keyboard-configuration/xkb-keymap select us
@@ -15,14 +13,12 @@ d-i time/zone string UTC
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
scheme :: \
200 0 200 ext4 \
512 50 512 fat32 \
$primary{ } \
$bootable{ } \
method{ format } \
method{ efi } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /boot } . \
mountpoint{ /boot/efi } . \
200% 0 200% linux-swap \
$primary{ } \
method{ swap } \
@@ -39,13 +35,24 @@ d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Settings for package manager
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false
d-i mirror/country string manual
d-i mirror/http/hostname string httpredir.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
# Package selection
tasksel tasksel/first multiselect
d-i pkgsel/include string curl openssh-server sudo python3
d-i pkgsel/include string curl openssh-server sudo python3 network-manager
popularity-contest popularity-contest/participate boolean false
d-i grub-installer/bootdev string default
d-i grub-installer/force-efi-extra-removable boolean true
d-i finish-install/reboot_in_progress note
@@ -55,8 +62,9 @@ d-i preseed/early_command string
-e "/in-target/i echo 'discover=d' >> /target/etc/discover-pkginstall.conf" \
/usr/lib/pre-pkgsel.d/20install-hwpackages
d-i preseed/late_command string \
echo 'Defaults:vagrant !nrequiretty' > /target/etc/sudoers.d/vagrant; \
echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \
chmod 440 /target/etc/sudoers.d/vagrant; \
sed -i -e 's/ens3/ens5/g' /target/etc/network/interfaces; \
in-target apt-get update; \
in-target apt-get upgrade -y
in-target apt-get upgrade -y
+9 -2
View File
@@ -5,6 +5,13 @@
provider: virtualbox-iso
- arch: amd64
provider: vmware-iso
- arch: amd64
provider: hyperv-iso
11: *supp
12: *supp
#9: *supp # EOL
12:
- arch: amd64
provider: qemu
- arch: amd64
provider: vmware-iso
- arch: amd64
provider: hyperv-iso
@@ -99,6 +99,14 @@ else
exit 1
fi
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
dnf install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
fi
if [ "$(arch)" = "x86_64" ]; then
# Set up legacy BIOS boot if we booted from UEFI
grub2-install --target=i386-pc "${device}"
+2 -2
View File
@@ -6,8 +6,8 @@ iso = {
}
boot_command = [
"<up>e<down><down><end> ",
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/x86_64.ks console=tty0<f10>"
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg console=tty0<f10>"
]
cd_files = [
"distros/fedora/37/*.ks"
"distros/fedora/37/*.cfg"
]
@@ -91,6 +91,13 @@ else
exit 1
fi
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
dnf install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
fi
if [ "$(arch)" = "x86_64" ]; then
# Set up legacy BIOS boot if we booted from UEFI
+2 -2
View File
@@ -6,8 +6,8 @@ iso = {
}
boot_command = [
"<up>e<down><down><end> ",
"net.ifnames=0 <wait>biosdevnames=0 <wait>inst.ks=cdrom:/x86_64.ks <wait>console=tty0<f10>"
"net.ifnames=0 <wait>biosdevnames=0 <wait>inst.ks=cdrom:/amd64-ks.cfg <wait>console=tty0<f10>"
]
cd_files = [
"distros/fedora/38/*.ks"
"distros/fedora/38/*.cfg"
]
@@ -98,6 +98,13 @@ else
exit 1
fi
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
dnf install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
fi
if [ "$(arch)" = "x86_64" ]; then
# Set up legacy BIOS boot if we booted from UEFI
+2 -2
View File
@@ -6,8 +6,8 @@ iso = {
}
boot_command = [
"<up>e<down><down><end> ",
"net.if<wait>names=0<wait> biosdev<wait>names=0<wait> inst.ks=<wait>cdrom:/x86_64.ks<wait> console<wait>=tty0<f10>"
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg console=tty0<f10>"
]
cd_files = [
"distros/fedora/39/*.ks"
"distros/fedora/39/*.cfg"
]
@@ -33,7 +33,7 @@ url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=rawhide&arch=
reboot
##### begin package list #############################################
%packages --instLangs=en
%packages --inst-langs=en
# Include packages for the cloud-server-environment group
@^cloud-server-environment
@@ -97,6 +97,13 @@ else
exit 1
fi
virt="$(systemd-detect-virt)"
if [ "${virt}" == "microsoft" ]; then
dnf install -y hyperv-daemons
systemctl enable hpervfcopyd
systemctl enable hypervkvpd
systemctl enable hypervvssd
fi
if [ "$(arch)" = "x86_64" ]; then
# Set up legacy BIOS boot if we booted from UEFI
+2 -2
View File
@@ -35,10 +35,10 @@ iso = {
}
boot_command = [
"<up>e<down><down><end><bs><bs><bs><bs><bs>",
"net.ifnames=0<wait> biosdevnames=0<wait> inst.ks=cdrom:/x86_64.ks<wait> console=tty0<wait> console=<wait>ttyS0<f10>"
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg console=tty0 console=ttyS0<f10>"
]
cd_files = [
"distros/fedora/rawhide/*.ks"
"distros/fedora/rawhide/*.cfg"
]
EOF
+4 -6
View File
@@ -29,14 +29,12 @@ iso = {
checksum = "${sha}"
}
boot_command = [
"<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>",
"<wait60>", # Wait for system to come up?
"curl<wait> -o<wait> /tmp/install.sh<wait> http://<wait>{{ .HTTPIP }}<wait>:{{ .HTTPPort }}<wait>/install.sh<enter>",
"<wait>",
"sudo<wait> bash<wait> /tmp/install.sh<wait> {{ .HTTPPort }}<wait> {{ .HTTPIP }}<enter>"
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait5>",
"sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
]
http_directory = "distros/nixos/23.05/http/"
boot_wait = "5s"
boot_wait = "60s"
EOF
rm -r "${tmp}"
+6 -4
View File
@@ -3,7 +3,7 @@
{
imports = [
./hardware-configuration.nix
#PROVIDER_PLACEHOLDER
./guest-agent.nix
];
system.stateVersion = "23.05";
@@ -37,9 +37,11 @@
}
];
boot.loader.grub = {
enable = true;
devices = [ "@BOOT_DEVICE@" ];
boot.loader = {
systemd-boot = {
enable = true;
};
efi.canTouchEfiVariables = true;
};
networking = {
hostName = "vagrant";
+1
View File
@@ -0,0 +1 @@
ga-qemu.nix
@@ -0,0 +1,4 @@
{...}:
{
virtualisation.hypervGuest.enable = true;
}
+7
View File
@@ -0,0 +1,7 @@
{...}:
{
virtualisation.virtualbox.guest = {
enable = true;
x11 = false;
};
}
+4
View File
@@ -0,0 +1,4 @@
{...}:
{
services.qemuGuest.enable = true;
}
+7
View File
@@ -0,0 +1,7 @@
{...}:
{
virtualisation.vmware.guest = {
enable = true;
headless = false;
}
}
+22 -7
View File
@@ -15,30 +15,42 @@ fi
# The sed bit is just to strip out the extra fluff, like comments
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${disk}
o # create new DOS partition table
g # create new GPT partition table
n # new
p # primary partition
1 # part number
# default partition number
# default start
+512M # size
t # set type
1 # EFI system partition
n # second partition
# default partition number
# start at first free sector
# default to full disk
p # print, for debugging
w # write the partition table and exit
EOF
sleep 10 # Let me at least read it!
#t # set partition type
#1 # on partition 1
#4 # BIOS boot
# Format and mount partitions
mkfs.ext4 -L root "${disk}1"
mkfs.vfat "${disk}1"
mkfs.ext4 "${disk}2"
mount "${disk}1" /mnt
mount "${disk}2" /mnt
mkdir -p /mnt/boot
mount "${disk}1" /mnt/boot
# Bootstrap system
virt="$(systemd-detect-virt)"
nixos-generate-config --root /mnt
curl -o /mnt/etc/nixos/configuration.nix "http://${host}:${port}/configuration.nix"
curl -o /mnt/etc/nixos/flake.nix "http://${host}:${port}/flake.nix"
curl -o /mnt/etc/nixos/guest-agent.nix "http://${host}:${port}/ga-${virt}.nix"
sed -i -E -e "s,@BOOT_DEVICE@,${disk}," /mnt/etc/nixos/configuration.nix
sed -i -E -e 's,(.*device = "/dev/disk/).*(".*),\1by-label/root\2,' /mnt/etc/nixos/hardware-configuration.nix
nixos-install --no-root-password --flake "/mnt/etc/nixos/#vagrant"
# Run stuff in the chroot
@@ -46,4 +58,7 @@ curl -o /mnt/root/in-chroot.sh "http://${host}:${port}/in-chroot.sh"
nixos-enter --root /mnt -c 'bash /root/in-chroot.sh'
rm /mnt/root/in-chroot.sh
reboot
umount /mnt/boot
umount /mnt
efibootmgr --bootnext "$(efibootmgr | grep Linux | awk '{print $1}' | sed -E 's/[^0-9]//g')"
reboot
+4 -6
View File
@@ -29,14 +29,12 @@ iso = {
checksum = "${sha}"
}
boot_command = [
"<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>",
"<wait120>", # Wait for system to come up?
"curl<wait> -o<wait> /tmp/install.sh<wait> http://<wait>{{ .HTTPIP }}<wait>:{{ .HTTPPort }}/<wait>install.sh<enter>",
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait>",
"sudo<wait> bash<wait> /tmp/install.sh<wait> {{ .HTTPPort }}<wait> {{ .HTTPIP }}<wait><enter>"
"sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
]
http_directory = "distros/nixos/23.05/http/"
boot_wait = "5s"
http_directory = "distros/nixos/23.11/http/"
boot_wait = "60s"
EOF
rm -r "${tmp}"
+6 -4
View File
@@ -3,7 +3,7 @@
{
imports = [
./hardware-configuration.nix
#PROVIDER_PLACEHOLDER
./guest-agent.nix
];
system.stateVersion = "23.11";
@@ -37,9 +37,11 @@
}
];
boot.loader.grub = {
enable = true;
devices = [ "@BOOT_DEVICE@" ];
boot.loader = {
systemd-boot = {
enable = true;
};
efi.canTouchEfiVariables = true;
};
networking = {
hostName = "vagrant";
+1
View File
@@ -0,0 +1 @@
ga-qemu.nix
@@ -0,0 +1,4 @@
{...}:
{
virtualisation.hypervGuest.enable = true;
}
+7
View File
@@ -0,0 +1,7 @@
{...}:
{
virtualisation.virtualbox.guest = {
enable = true;
x11 = false;
};
}
+4
View File
@@ -0,0 +1,4 @@
{...}:
{
services.qemuGuest.enable = true;
}
+7
View File
@@ -0,0 +1,7 @@
{...}:
{
virtualisation.vmware.guest = {
enable = true;
headless = false;
}
}
+22 -7
View File
@@ -15,30 +15,42 @@ fi
# The sed bit is just to strip out the extra fluff, like comments
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${disk}
o # create new DOS partition table
g # create new GPT partition table
n # new
p # primary partition
1 # part number
# default partition number
# default start
+512M # size
t # set type
1 # EFI system partition
n # second partition
# default partition number
# start at first free sector
# default to full disk
p # print, for debugging
w # write the partition table and exit
EOF
sleep 10 # Let me at least read it!
#t # set partition type
#1 # on partition 1
#4 # BIOS boot
# Format and mount partitions
mkfs.ext4 -L root "${disk}1"
mkfs.vfat "${disk}1"
mkfs.ext4 "${disk}2"
mount "${disk}1" /mnt
mount "${disk}2" /mnt
mkdir -p /mnt/boot
mount "${disk}1" /mnt/boot
# Bootstrap system
virt="$(systemd-detect-virt)"
nixos-generate-config --root /mnt
curl -o /mnt/etc/nixos/configuration.nix "http://${host}:${port}/configuration.nix"
curl -o /mnt/etc/nixos/flake.nix "http://${host}:${port}/flake.nix"
curl -o /mnt/etc/nixos/guest-agent.nix "http://${host}:${port}/ga-${virt}.nix"
sed -i -E -e "s,@BOOT_DEVICE@,${disk}," /mnt/etc/nixos/configuration.nix
sed -i -E -e 's,(.*device = "/dev/disk/).*(".*),\1by-label/root\2,' /mnt/etc/nixos/hardware-configuration.nix
nixos-install --no-root-password --flake "/mnt/etc/nixos/#vagrant"
# Run stuff in the chroot
@@ -46,4 +58,7 @@ curl -o /mnt/root/in-chroot.sh "http://${host}:${port}/in-chroot.sh"
nixos-enter --root /mnt -c 'bash /root/in-chroot.sh'
rm /mnt/root/in-chroot.sh
reboot
umount /mnt/boot
umount /mnt
efibootmgr --bootnext "$(efibootmgr | grep Linux | awk '{print $1}' | sed -E 's/[^0-9]//g')"
reboot
+1 -11
View File
@@ -1,12 +1,2 @@
#!/usr/bin/env bash
set -ex
sed -i -e 's,#PROVIDER_PLACEHOLDER,./guest-agent.nix,' /etc/nixos/configuration.nix
cat << EOF > /etc/nixos/guest-agent.nix
{...}:
{
services.qemuGuest.enable = true;
}
EOF
chown vagrant:vagrant /etc/nixos/guest-agent.nix
nixos-rebuild switch
set -ex
+1 -14
View File
@@ -1,15 +1,2 @@
#!/usr/bin/env bash
set -ex
sed -i -e 's,#PROVIDER_PLACEHOLDER,./guest-agent.nix,' /etc/nixos/configuration.nix
cat << EOF > /etc/nixos/guest-agent.nix
{...}:
{
virtualisation.virtualbox.guest = {
enable = true;
x11 = false;
};
}
EOF
chown vagrant:vagrant /etc/nixos/guest-agent.nix
nixos-rebuild switch
set -ex
+1 -14
View File
@@ -1,15 +1,2 @@
#!/usr/bin/env bash
set -ex
sed -i -e 's,#PROVIDER_PLACEHOLDER,./guest-agent.nix,' /etc/nixos/configuration.nix
cat << EOF > /etc/nixos/guest-agent.nix
{...}:
{
virtualisation.vmware.guest = {
enable = true;
headless = false;
};
}
EOF
chown vagrant:vagrant /etc/nixos/guest-agent.nix
nixos-rebuild switch
set -ex
+2 -2
View File
@@ -6,13 +6,13 @@ iso = {
}
boot_wait = "3s"
boot_command = [
"<enter><enter><wait1><f6><esc><wait><bs><bs><bs><bs>",
"e<wait><down><down><down><end><bs><bs><bs>",
"console=tty0 ",
"fsck.mode=skip ",
"locale=en_US ",
"auto=true ",
"priority=critical ",
"autoinstall ds=nocloud<enter><wait>"
"autoinstall ds=nocloud<f10>"
]
cd_files = [
"distros/ubuntu/20.04/disc/*"
+11 -1
View File
@@ -28,12 +28,22 @@ autoinstall:
allow-pw: yes
user-data:
disable_root: false
package_update: false # These will be done by Ansible after install
package_update: false
package_upgrade: false
late-commands:
- echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant
- echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /target/etc/sudoers.d/vagrant
- chmod 440 /target/etc/sudoers.d/vagrant
- >-
curtin in-target --target=/target --
bash -c 'if [ "$(systemd-detect-virt)" == "microsoft" ]; then
apt-get update;
apt-get install -y linux-azure;
fi'
# There is no efibootmgr in the install CD, so we need in-target to fetch the data first
- |-
TARGET="$(curtin in-target --target=/target -- efibootmgr | grep -i ubuntu | awk '{print $1}' | sed -E 's/[^0-9]//g')"
curtin in-target --target=/target -- efibootmgr --bootnext "${TARGET}"
- curtin in-target --target=/target -- logger "finished late-commands"
packages:
- ca-certificates
-3
View File
@@ -6,9 +6,6 @@ apt remove cloud-init -y
apt update
apt upgrade -y
# Do some magic with init
sed -i -E -e 's,^(ACTIVE_CONSOLES="/dev/tty).*",\11,' /etc/default/console-setup
# Make sshd faster
cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
UseDNS no
+6 -6
View File
@@ -6,12 +6,12 @@ iso = {
}
boot_command = [
"e<down><down><down><end><bs><bs><bs>",
"console=tty0 <wait>",
"fsck.mode=skip <wait>",
"locale=en_US <wait>",
"auto=true <wait>",
"priority=<wait>critical <wait>",
"autoinstall<wait>",
"console=tty0 ",
"fsck.mode=skip ",
"locale=en_US ",
"auto=true ",
"priority=critical ",
"autoinstall",
"<F10>",
]
cd_files = [
+10
View File
@@ -34,6 +34,16 @@ autoinstall:
- echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant
- echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /target/etc/sudoers.d/vagrant
- chmod 440 /target/etc/sudoers.d/vagrant
- >-
curtin in-target --target=/target --
bash -c 'if [ "$(systemd-detect-virt)" == "microsoft" ]; then
apt-get update;
apt-get install -y linux-azure;
fi'
# There is no efibootmgr in the install CD, so we need in-target to fetch the data first
- |-
TARGET="$(curtin in-target --target=/target -- efibootmgr | grep -i ubuntu | awk '{print $1}' | sed -E 's/[^0-9]//g')"
curtin in-target --target=/target -- efibootmgr --bootnext "${TARGET}"
- curtin in-target --target=/target -- logger "finished late-commands"
packages:
- ca-certificates
-3
View File
@@ -6,9 +6,6 @@ apt remove cloud-init -y
apt update
apt upgrade -y
# Do some magic with init
sed -i -E -e 's,^(ACTIVE_CONSOLES="/dev/tty).*",\11,' /etc/default/console-setup
# Make sshd faster
cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
UseDNS no

Some files were not shown because too many files have changed in this diff Show More