-
Notifications
You must be signed in to change notification settings - Fork 0
/
alpine.json
72 lines (58 loc) · 2.73 KB
/
alpine.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
"description": "Example Alpine installation on VMM",
"variables": {
"hostname": "alpine",
"domain": "example.com",
"nameservers": "4.4.8.8 8.8.8.8",
"username": "packer",
"password": "packer",
"public_key": "ssh-rsa AAAA...."
},
"builders": [
{
"type": "vmm",
"vm_name": "alpine-example",
"disk_size": "2G",
"format": "qcow2",
"mem_size": "512M",
"iso_urls": ["downloads/alpine-virt-3.8.1-x86_64.iso", "https://nl.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-virt-3.8.1-x86_64.iso"],
"iso_checksum": "83ede521b174d99a0975c3653e7310b58075fa68fb773ed6995b974a44df60ce",
"iso_checksum_type": "sha256",
"boot_wait": "10s",
"boot_command": [
"root<enter><wait>",
"echo 'KEYMAPOPTS=\"us us\"' > answers<enter>",
"echo 'HOSTNAMEOPTS=\"-n {{user `hostname`}}\"' >> answers<enter>",
"echo 'INTERFACESOPTS=\"auto lo<enter>iface lo inet loopback<enter><enter>auto eth0<enter>iface eth0 inet dhcp<enter>\"' >> answers<enter>",
"echo 'DNSOPTS=\"-d {{user `domain`}} {{user `nameservers`}}\"' >> answers<enter>",
"echo 'TIMEZONEOPTS=\"-z UTC\"' >> answers<enter>",
"echo 'PROXYOPTS=\"none\"' >> answers<enter>",
"echo 'APKREPOSOPTS=\"https://nl.alpinelinux.org/alpine/v3.8/main\"' >> answers<enter>",
"echo 'SSHDOPTS=\"-c openssh\"' >> answers<enter>",
"echo 'NTPOPTS=\"-c openntpd\"' >> answers<enter>",
"echo 'DISKOPTS=\"-m sys /dev/vdb\"' >> answers<enter>",
"mkdir -p /etc/udhcpc<enter>",
"echo 'dns=\"{{user `nameservers`}}\"' > /etc/udhcpc/udhcpc.conf<enter>",
"ifconfig eth0 up && udhcpc -i eth0<enter><wait>",
"setup-alpine -f $PWD/answers<enter><wait5>",
"{{user `password`}}<enter><wait>",
"{{user `password`}}<enter><wait>",
"<wait10s>y<enter>",
"<wait40s>",
"mount /dev/vdb3 /mnt<enter><wait>",
"chroot /mnt<enter>",
"apk add --update curl sudo<enter><wait5s>",
"echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel<enter>",
"adduser -D {{user `username`}}<enter><wait>",
"passwd -d '{{user `password`}}' {{user `username`}}<enter>",
"addgroup {{user `username`}} wheel<enter>",
"install -d -o {{user `username`}} -g {{user `username`}} -m 0700 /home/{{user `username`}}/.ssh<enter>",
"echo '{{user `public_key`}}' > /home/{{user `username`}}/.ssh/authorized_keys<enter>",
"chown {{user `username`}}:{{user `username`}} /home/{{user `username`}}/.ssh/authorized_keys<enter>",
"exit<enter>",
"umount /mnt<enter><wait>",
"/sbin/poweroff<enter><wait15>"
]
}
]
}