102 lines
2.6 KiB
Jsonnet
102 lines
2.6 KiB
Jsonnet
// This is a Jsonnet file. Please, check https://jsonnet.org/ for more
|
|
// information about the language.
|
|
// For the schema, see
|
|
// https://github.com/openSUSE/agama/blob/master/rust/agama-lib/share/profile.schema.json
|
|
|
|
// The "hw.libsonnet" file contains hardware information from the "lshw" tool.
|
|
// Agama generates this file at runtime by running (with root privileges):
|
|
//
|
|
// lshw -json
|
|
//
|
|
// There are included also helpers to search this hardware tree. To see helpers check
|
|
// "/usr/share/agama-cli/agama.libsonnet"
|
|
local agama = import 'hw.libsonnet';
|
|
|
|
// Find the biggest disk which is suitable for installing the system.
|
|
local findBiggestDisk(disks) =
|
|
local sizedDisks = std.filter(function(d) std.objectHas(d, 'size'), disks);
|
|
local sorted = std.sort(sizedDisks, function(x) -x.size);
|
|
sorted[0].logicalname;
|
|
|
|
// Find how much physical memory system has.
|
|
local memory = agama.findByID(agama.lshw, 'memory').size;
|
|
|
|
{
|
|
product: {
|
|
id: 'Leap_16.0',
|
|
},
|
|
software: {
|
|
patterns: [
|
|
],
|
|
},
|
|
user: {
|
|
fullName: 'vagrant',
|
|
userName: 'vagrant',
|
|
password: 'vagrant',
|
|
},
|
|
root: {
|
|
password: 'vagrant',
|
|
},
|
|
localization: {
|
|
language: 'en_US',
|
|
keyboard: 'us',
|
|
},
|
|
storage: {
|
|
boot: {
|
|
configure: true,
|
|
device: findBiggestDisk(agama.selectByClass(agama.lshw, 'disk')),
|
|
},
|
|
drives: [{
|
|
search: findBiggestDisk(agama.selectByClass(agama.lshw, 'disk')),
|
|
ptableType: 'gpt',
|
|
partitions: [{
|
|
search: '*',
|
|
delete: true
|
|
},{
|
|
id: 'esp',
|
|
size: '512 MiB',
|
|
filesystem: {
|
|
type: 'vfat',
|
|
path: '/boot',
|
|
mountBy: 'label',
|
|
label: 'boot',
|
|
mountOptions: [ "noatime" ]
|
|
},
|
|
},{
|
|
id: 'linux',
|
|
size: {
|
|
min: '9 GiB',
|
|
},
|
|
filesystem: {
|
|
type: 'ext4',
|
|
path: '/',
|
|
mountBy: 'label',
|
|
label: 'root',
|
|
mountOptions: [ "noatime" ]
|
|
}
|
|
}]
|
|
}]
|
|
},
|
|
scripts: {
|
|
pre: [],
|
|
post: [ {
|
|
name: 'configure-vagrant',
|
|
body: |||
|
|
# Configure the insecure Vagrant SSH key
|
|
mkdir -p /home/vagrant/.ssh
|
|
curl -o /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub
|
|
chown -R vagrant /home/vagrant/.ssh
|
|
chmod 600 /home/vagrant/.ssh
|
|
# Start services
|
|
systemctl enable sshd
|
|
# Configure sudo access for the vagrant user
|
|
cat < EOF > /etc/sudoers/sudoers.d/00_vagrant
|
|
Defaults:vagrant !requiretty
|
|
vagrant ALL=(ALL) NOPASSWD: ALL
|
|
root ALL=(ALL) NOPASSWD: ALL
|
|
EOF
|
|
|||
|
|
} ]
|
|
},
|
|
}
|