Packer 用户自定义变量

Packer 打包 box 时用到的用户自定义变量,单独写进一个文件里有利于解耦。


开始

{
  "_comment": "Modify the following variables to suit your needs,Build with `packer build -var-file variables-centos7.9.json centos.json`",
  "default_vm_name": "centos-7.9-x86_64",
  "guest_additions_url": "",
  "mirror": "http://mirrors.aliyun.com/centos",
  "mirror_directory": "7.9.2009/isos/x86_64",
  "iso_checksum": "07b94e6b1a0b0260b94c83d6bb76b26bf7a310dc78d7a9c7432809fb9bc6194a",
  "iso_name": "CentOS-7-x86_64-Minimal-2009.iso",
  "http_directory": "{{pwd}}/http",
  "build_directory": "../builds",
  "box_basename": "centos-7.9",
  "headless": "",
  "cpus": "1",
  "memory": "1024",
  "disk_size": "40960",
  "ks_path": "7/ks.cfg",
  "ssh_username": "echoxu",
  "ssh_password": "Xjh@911128",
  "ssh_pubkey": "sshkey/id_rsa_vagrant.pub"
}

需要做的修改:

1:通过 ssh-keygen -b 4096 -t rsa -N '' -C "ssh key for packer" -m PEM -f id_rsa_vagrant 重新生成密钥并替换上面的 ssh_pubkey

2:修改 ssh_username 以及 ssh_password

上次更新:
贡献者: iEchoxu