cloud.json 2.48 KB
Newer Older
Christian Rebischke's avatar
Christian Rebischke committed
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
73
74
75
76
77
78
79
80
81
{
    "variables": {
        "iso_url": "https://mirror.pkgbuild.com/iso/latest/archlinux-2019.10.01-x86_64.iso",
        "iso_checksum_url": "https://mirror.pkgbuild.com/iso/latest/sha1sums.txt",
        "iso_checksum_type": "sha1",
        "disk_size": "20480",
        "memory": "1024",
        "cpus": "2",
        "headless": "true",
        "write_zeroes": "",
        "boot_wait": "60s"
    },
    "builders": [
        {
            "type": "qemu",
            "boot_wait": "{{user `boot_wait`}}",
            "http_directory": "http",
            "disk_size": "{{user `disk_size`}}",
            "iso_checksum_url": "{{user `iso_checksum_url`}}",
            "iso_checksum_type": "{{user `iso_checksum_type`}}",
            "iso_url": "{{user `iso_url`}}",
            "ssh_username": "arch",
            "ssh_password": "arch",
            "ssh_port": 22,
            "ssh_wait_timeout": "10000s",
            "shutdown_command": "sudo systemctl poweroff",
            "headless": "{{user `headless`}}",
            "qemuargs": [
                [
                    "-m",
                    "{{user `memory`}}"
                ],
                [
                    "-smp",
                    "{{user `cpus`}}"
                ]
            ],
            "boot_command": [
                "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'<enter><wait>",
                "bash install.sh < install-cloud.sh && systemctl reboot<enter>"
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "scripts": [
                "provision/postinstall.sh",
                "provision/qemu.sh",
		"provision/cloud-init.sh",
                "provision/cleanup.sh"
            ],
            "execute_command": "echo 'arch'|sudo -S sh '{{.Path}}'"
        },
        {
            "type": "shell",
            "scripts": [
                "provision/write_zeroes.sh"
            ],
            "execute_command": "if [ ! -z \"{{user `write_zeroes`}}\" ]; then echo 'arch'|sudo -S sh '{{.Path}}'; fi"
        }
    ],
    "post-processors": [
        [
            {
                "type": "checksum",
		"checksum_types": [
			"sha256"
		],
                "output": "Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img"
            },
	    {
		"type": "shell-local",
		"inline": [
			"gpg --sign --detach-sign Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img"
		]
	    }
	]
    ]
}