Joe*_*l B 5 packer vagrant vagrantfile
是否有可能使用Packer在我的本地机器上完全创建/托管的盒子而不在HashiCorp Atlas上发布?当我这样做时,vagrant box list我会得到以下内容:
vagrant box list
Win8 (virtualbox, 0)
dummy (aws, 0)
Run Code Online (Sandbox Code Playgroud)
其中显示了最后一列中的框版本.我希望能够在包装过程中更改该号码.他们的文档似乎暗示我只能通过使用他们的Atlas获得此功能:
如果您想支持版本控制,将多个提供商放在一个URL上,推送更新,分析等,我们建议您将该框添加到HashiCorp的Atlas
这可以通过模仿 Vagrant 对 HashiCorp Atlas API 的期望来实现。创建一个 JSON 文件,其中包含 API 文档中提到的相关框元数据(在VagrantUp 上和Atlas上):
{
"description": "A long description of your box.",
"short_description":"Short description",
"name": "yourname/boxname",
"versions": [
{
"version": "1.0.0",
"status":"revoked",
"description_html":null,
"description_markdown":null,
"created_at" : "2015-08-13T07:39:00.000Z",
"updated_at" : "2015-08-13T07:39:00.000Z",
"providers": [
{
"checksum": "foo",
"checksum_type": "md5",
"name": "virtualbox",
"url": "file:////192.168.1.1/Vagrant/ubuntu-14-04-x64-virtualbox-1.0.0.box"
}
]
},
{
"version": "1.1.0",
"status":"active",
"description_html":null,
"description_markdown":null,
"created_at" : "2015-08-15T19:05:00.000Z",
"updated_at" : "2015-08-15T19:05:00.000Z",
"providers": [
{
"checksum": "bar",
"checksum_type": "md5",
"name": "virtualbox",
"url": "file:////192.168.1.1/Vagrant/ubuntu-14-04-x64-virtualbox-1.1.0.box"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
将其另存为boxname.json(我认为这不是必需的,但我相信这是阿特拉斯约定)。Vagrantfile然后简单地从你那里调用它
# Enable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
config.vm.box_check_update = true
# The path to the box metadata file
config.vm.box = "yourname/boxname"
config.vm.box_url = "file://./boxname.json"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2100 次 |
| 最近记录: |