mirror of
https://github.com/outbackdingo/ack-image-builder.git
synced 2026-01-27 10:18:13 +00:00
add aliyunlinux 3 example to support cgroup v2 custom image
This commit is contained in:
43
examples/ack-aliyunlinux3.json
Normal file
43
examples/ack-aliyunlinux3.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"variables": {
|
||||
"region": "cn-hangzhou",
|
||||
"image_name": "test_image{{timestamp}}",
|
||||
"source_image": "aliyun_3_x64_20G_alibase_20221102.vhd",
|
||||
"instance_type": "ecs.g6.2xlarge",
|
||||
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
|
||||
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"type": "alicloud-ecs",
|
||||
"access_key": "{{user `access_key`}}",
|
||||
"secret_key": "{{user `secret_key`}}",
|
||||
"region": "{{user `region`}}",
|
||||
"image_name": "{{user `image_name`}}",
|
||||
"source_image": "{{user `source_image`}}",
|
||||
"ssh_username": "root",
|
||||
"instance_type": "{{user `instance_type`}}",
|
||||
"skip_image_validation": "true",
|
||||
"io_optimized": "true",
|
||||
"associate_public_ip_address": "true"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"environment_vars": [
|
||||
"CGROUP_MODE={{user `cgroup_mode`}}"
|
||||
],
|
||||
"scripts": [
|
||||
"scripts/set-cgroupv2.sh",
|
||||
"scripts/updateKernel.sh",
|
||||
"scripts/reboot.sh",
|
||||
"scripts/cleanUpKerneles.sh",
|
||||
"config/default.sh",
|
||||
"scripts/disableTuned.sh",
|
||||
"scripts/verify.sh"
|
||||
],
|
||||
"expect_disconnect": true
|
||||
}
|
||||
]
|
||||
}
|
||||
11
scripts/set-cgroupv2.sh
Normal file
11
scripts/set-cgroupv2.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
echo $CGROUP_MODE
|
||||
|
||||
if [[ ! -z $CGROUP_MODE ]] && [[ $CGROUP_MODE =~ .*[v,V]2.* ]]; then
|
||||
echo "set cgroup mode to $CGROUP_MODE"
|
||||
if ! grep -q 'systemd.unified_cgroup_hierarchy=1' /etc/default/grub; then
|
||||
grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user