Skip to content

Instantly share code, notes, and snippets.

@minimum2scp
Created December 4, 2015 20:35
Show Gist options
  • Select an option

  • Save minimum2scp/db671ba2f00b7cd48ca3 to your computer and use it in GitHub Desktop.

Select an option

Save minimum2scp/db671ba2f00b7cd48ca3 to your computer and use it in GitHub Desktop.
GCE に Debian sid のイメージを作る packer テンプレート

build images

build jessie-base image

packer build -var account_file=/path/to/credential.json --var project_id=your-proj-id jessie-base.json

build sid-base image

packer build -var account_file=/path/to/credential.json --var project_id=your-proj-id sid-base.json

TODO

  • replace ntp with systemd-timesyncd
{
"variables": {
"account_file": "",
"project_id": ""
},
"builders": [{
"type": "googlecompute",
"account_file": "{{user `account_file`}}",
"project_id": "{{user `project_id`}}",
"source_image": "debian-8-jessie-v20151104",
"zone": "asia-east1-a",
"machine_type": "f1-micro",
"image_name": "jessie-base"
}],
"provisioners":[{
"type": "shell",
"inline": [
"apt-get update",
"apt-get install -y --no-install-recommends etckeeper",
"echo 'Asia/Tokyo' > /etc/timezone",
"dpkg-reconfigure -f noninteractive tzdata",
"etckeeper commit 'setup timezone'",
"apt-get upgrade -y --no-install-recommends --auto-remove --purge"
],
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
]
}]
}
{
"variables": {
"account_file": "",
"project_id": ""
},
"builders": [{
"type": "googlecompute",
"account_file": "{{user `account_file`}}",
"project_id": "{{user `project_id`}}",
"source_image": "jessie-base",
"zone": "asia-east1-a",
"machine_type": "f1-micro",
"image_name": "sid-base"
}],
"provisioners":[
{
"type": "file",
"source": "sources.list",
"destination": "/etc/apt/sources.list"
},
{
"type": "shell",
"inline": [
"etckeeper commit 'apt: updated to sid'",
"apt-get remove -y --purge --auto-remove ntp",
"apt-get update",
"apt-get dist-upgrade -y --no-install-recommends --auto-remove --purge"
],
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
]
}
]
}
##
## stable
##
deb http://httpredir.debian.org/debian/ stable main non-free contrib
deb-src http://httpredir.debian.org/debian/ stable main non-free contrib
deb http://httpredir.debian.org/debian/ stable-updates main contrib non-free
deb-src http://httpredir.debian.org/debian/ stable-updates main contrib non-free
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
##
## testing
##
deb http://httpredir.debian.org/debian/ testing main non-free contrib
deb-src http://httpredir.debian.org/debian/ testing main non-free contrib
##
## sid
##
deb http://httpredir.debian.org/debian/ sid main non-free contrib
deb-src http://httpredir.debian.org/debian/ sid main non-free contrib
##
## experimental
##
deb http://httpredir.debian.org/debian/ experimental main non-free contrib
deb-src http://httpredir.debian.org/debian/ experimental main non-free contrib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment