base.json 2.66 KB
Newer Older
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
82
83
84
85
86
87
88
{
  "_comment": "Build with `packer build ubuntu.json`",
  "builders": [
    {
      "iso_urls": [ "output-ubuntu1804/ubuntu1804" ],
      "iso_checksum": "none",
      "disk_image": "true",
      "use_backing_file": "true",
      "headless": "{{ user `headless` }}",
      "disable_vnc": "false",
      "output_directory": "output-{{ user `vm_name` }}",
      "qemuargs": [
        [
          "-m",
          "{{ user `memory` }}"
        ],
        [
          "-display",
          "none"
        ],
        [
          "-machine",
          "accel=kvm"
        ],
        [
          "-cpu",
          "host"
        ],
        [
          "-smp",
          "cpus={{ user `cpus`}}"
        ],
        [
            "-serial",
            "mon:stdio"
        ]
      ],
      "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now",
      "ssh_password": "{{ user `ssh_password` }}",
      "ssh_timeout": "10000s",
      "ssh_username": "{{ user `ssh_username` }}",
      "type": "qemu",
      "vm_name": "{{ user `vm_name` }}"
    }
  ],
  "provisioners": [
    {
      "type": "file",
      "source": "scripts/guestinit.sh",
      "destination": "/home/ubuntu/guestinit.sh",
      "direction": "upload"
    },
    {
      "type": "file",
      "source": "bzImage",
      "destination": "/tmp/bzImage",
      "direction": "upload"
    },
    {
      "type": "file",
      "source": "kernel/config-5.4.46",
      "destination": "/tmp/config-5.4.46",
      "direction": "upload"
    },
    {
      "type": "file",
      "source": "kheaders.tar.bz2",
      "destination": "/tmp/kheaders.tar.bz2",
      "direction": "upload"
    },
    {
      "type": "shell",
      "inline": [
          "sudo mv /tmp/bzImage /boot/vmlinuz-5.4.46",
          "sudo mv /tmp/config-5.4.46 /boot/config-5.4.46",
          "sudo update-grub",
          "cd / && sudo tar xf /tmp/kheaders.tar.bz2"
      ]
    },
    {
      "type": "file",
      "source": "m5",
      "destination": "/tmp/m5",
      "direction": "upload"
    },
    {
      "type": "shell",
      "inline": ["sudo mv /tmp/m5 /sbin/m5"]
89
90
91
92
93
94
95
    },
    {
      "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
      "scripts": [
        "scripts/install-base.sh"
      ],
      "type": "shell"
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    }
  ],
  "variables": {
    "cleanup_pause": "",
    "cpus": "4",
    "custom_script": ".",
    "desktop": "false",
    "disk_size": "10000",
    "headless": "", "hostname": "vagrant",
    "memory": "4096",
    "preseed": "preseed.cfg",
    "ssh_fullname": "vagrant",
    "ssh_password": "ubuntu",
    "ssh_username": "ubuntu",
    "vagrantfile_template": "",
    "version": "0.1.0",
    "vm_name": "base"
  }
}