initial port

This commit is contained in:
Jeff Escalante 2020-03-18 18:46:47 -04:00
parent 07be1a0a30
commit 92d4553890
No known key found for this signature in database
GPG Key ID: 32D23C61AB5450DB
670 changed files with 39200 additions and 15919 deletions

View File

@ -42,7 +42,7 @@ import (
// ```
// The above configuration would create the following files:
//
// ```
// ```text
// ./output_vsphere/example-ubuntu-disk-0.vmdk
// ./output_vsphere/example-ubuntu.mf
// ./output_vsphere/example-ubuntu.ovf

18
website/.editorconfig Normal file
View File

@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[Makefile]
indent_style = tab
[{*.md,*.json}]
max_line_length = null

4
website/.eslintrc.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
...require('@hashicorp/nextjs-scripts/.eslintrc.js'),
ignorePatterns: ['public/']
}

5
website/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
node_modules
.DS_Store
.next
out
.mdx-data

View File

@ -0,0 +1,8 @@
{
"ignore": {
"marked": {
"versions": "0.8.0",
"reason": "Broken IE"
}
}
}

7
website/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM node:10.16.3-alpine
RUN apk add --update --no-cache git make g++ automake autoconf libtool nasm libpng-dev
COPY ./package.json /website/package.json
COPY ./package-lock.json /website/package-lock.json
WORKDIR /website
RUN npm install

View File

@ -1,3 +0,0 @@
source "https://rubygems.org"
gem "middleman-hashicorp", "0.3.44"

View File

@ -1,161 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
autoprefixer-rails (9.7.4)
execjs
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.4)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
chunky_png (1.3.11)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
compass-import-once (~> 1.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
sass (>= 3.3.13, < 3.5)
compass-core (1.0.3)
multi_json (~> 1.0)
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
ffi (1.12.2)
haml (5.1.2)
temple (>= 0.8.0)
tilt
hike (1.2.3)
hooks (0.4.1)
uber (~> 0.0.14)
http_parser.rb (0.6.0)
i18n (0.7.0)
json (2.3.0)
kramdown (1.17.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
middleman (3.4.1)
coffee-script (~> 2.2)
compass (>= 1.0.0, < 2.0.0)
compass-import-once (= 1.0.5)
execjs (~> 2.0)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-core (= 3.4.1)
middleman-sprockets (>= 3.1.2)
sass (>= 3.4.0, < 4.0)
uglifier (~> 2.5)
middleman-core (3.4.1)
activesupport (~> 4.1)
bundler (~> 1.1)
capybara (~> 2.4.4)
erubis
hooks (~> 0.3)
i18n (~> 0.7.0)
listen (~> 3.0.3)
padrino-helpers (~> 0.12.3)
rack (>= 1.4.5, < 2.0)
thor (>= 0.15.2, < 2.0)
tilt (~> 1.4.1, < 2.0)
middleman-hashicorp (0.3.44)
bootstrap-sass (~> 3.3)
builder (~> 3.2)
middleman (~> 3.4)
middleman-livereload (~> 3.4)
middleman-syntax (~> 3.0)
redcarpet (~> 3.3)
turbolinks (~> 5.0)
middleman-livereload (3.4.6)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
rack-livereload (~> 0.3.15)
middleman-sprockets (3.5.0)
middleman-core (>= 3.3)
sprockets (~> 2.12.1)
sprockets-helpers (~> 1.1.0)
sprockets-sass (~> 1.3.0)
middleman-syntax (3.2.0)
middleman-core (>= 3.2)
rouge (~> 3.2)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
mini_portile2 (2.4.0)
minitest (5.14.0)
multi_json (1.14.1)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
padrino-helpers (0.12.9)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.12.9)
tilt (>= 1.4.1, < 3)
padrino-support (0.12.9)
activesupport (>= 3.1)
rack (1.6.13)
rack-livereload (0.3.17)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.0)
rouge (3.16.0)
sass (3.4.25)
sassc (2.2.1)
ffi (~> 1.9)
sprockets (2.12.5)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-helpers (1.1.0)
sprockets (~> 2.0)
sprockets-sass (1.3.1)
sprockets (~> 2.0)
tilt (~> 1.1)
temple (0.8.2)
thor (1.0.1)
thread_safe (0.3.6)
tilt (1.4.1)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.6)
thread_safe (~> 0.1)
uber (0.0.15)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
xpath (2.1.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
middleman-hashicorp (= 0.3.44)
BUNDLED WITH
1.17.3

View File

@ -1,30 +1,56 @@
configure_cache:
mkdir -p tmp/cache
build: configure_cache
@echo "==> Starting build in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--volume "$(shell pwd):/opt/buildhome/repo" \
--volume "$(shell pwd)/tmp/cache:/opt/buildhome/cache" \
--env "ENV=production" \
netlify/build \
build middleman build --verbose
website: configure_cache
# Default: run this if working on the website locally to run in watch mode.
website:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/packer-website
@echo "==> Starting website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--volume "$(shell pwd):/opt/buildhome/repo" \
--volume "$(shell pwd)/tmp/cache:/opt/buildhome/cache" \
--publish "4567:4567" \
--publish "35729:35729" \
--env "ENV=production" \
netlify/build \
build middleman
--workdir "/website" \
--volume "$(shell pwd):/website" \
--volume "/website/node_modules" \
--publish "3000:3000" \
hashicorp/packer-website \
npm start
.PHONY: build website
# This command will generate a static version of the website to the "out" folder.
build:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/packer-website
@echo "==> Starting build in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd):/website" \
--volume "/website/node_modules" \
hashicorp/packer-website \
npm run static
# If you are changing node dependencies locally, run this to generate a new
# local Docker image with the dependency changes included.
build-image:
@echo "==> Building Docker image..."
@docker build -t hashicorp-packer-website-local .
# Use this if you have run `build-image` to use the locally built image
# rather than our CI-generated image to test dependency changes.
website-local:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/packer-website
@echo "==> Starting website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd):/website" \
--volume "/website/node_modules" \
--publish "3000:3000" \
hashicorp-packer-website-local \
npm start
.DEFAULT_GOAL := website
.PHONY: build build-image website website-local

View File

@ -1,22 +1,114 @@
# Packer Website
This subdirectory contains the entire source for the [Packer Website][packer].
This is a [Middleman][middleman] project, which builds a static site from these
source files.
[![Netlify Status](https://img.shields.io/netlify/f7fa8963-0022-4a0e-9ccf-f5385355906b?style=flat-square)](https://app.netlify.com/sites/packer-docs-platform/deploys)
This subdirectory contains the entire source for the [Packer Website](https://packer.io/). This is a [NextJS](https://nextjs.org/) project, which builds a static site from these source files.
## Contributions Welcome!
If you find a typo or you feel like you can improve the HTML, CSS, or
JavaScript, we welcome contributions. Feel free to open issues or pull requests
like any normal GitHub project, and we'll merge it in.
If you find a typo or you feel like you can improve the HTML, CSS, or JavaScript, we welcome contributions. Feel free to open issues or pull requests like any normal GitHub project, and we'll merge it in 🚀
## Running the Site Locally
1. Install [Docker](https://docs.docker.com/engine/installation/) if you have not already done so
2. Clone this repo and run `make website`
The website can be run locally through node.js or Docker. If you choose to run through Docker, everything will be a little bit slower due to the additional overhead, so for frequent contributors it may be worth it to use node. Also if you are a vim user, it's also worth noting that vim's swapfile usage can cause issues for the live reload functionality. In order to avoid these issues, make sure you have run `:set backupcopy=yes` within vim.
Then open up `http://localhost:4567`. Note that some URLs you may need to append
".html" to make them work (in the navigation).
### With Docker
[middleman]: https://www.middlemanapp.com
[packer]: https://www.packer.io
Running the site locally is simple. Provided you have Docker installed, clone this repo, run `make`, and then visit `http://localhost:3000`.
The docker image is pre-built with all the website dependencies installed, which is what makes it so quick and simple, but also means if you need to change dependencies and test the changes within Docker, you'll need a new image. If this is something you need to do, you can run `make build-image` to generate a local Docker image with updated dependencies, then `make website-local` to use that image and preview.
### With Node
If your local development environment has a supported version (v10.0.0+) of [node installed](https://nodejs.org/en/) you can run:
- `npm install`
- `npm start`
and then visit `http://localhost:3000`.
If you pull down new code from github, you should run `npm install` again. Otherwise, there's no need to re-run `npm install` each time the site is run, you can just run `npm start` to get it going.
## Editing Content
Documentation content is written in [Markdown](https://www.markdownguide.org/cheat-sheet/) and you'll find all files listed under the `/pages` directory.
To create a new page with Markdown, create a file ending in `.mdx` in the `pages/` directory. The path in the pages directory will be the URL route. For example, `pages/hello/world.mdx` will be served from the `/hello/world` URL.
This file can be standard Markdown and also supports [YAML frontmatter](https://middlemanapp.com/basics/frontmatter/). YAML frontmatter is optional, there are defaults for all keys.
```yaml
---
title: 'My Title'
description: "A thorough, yet succinct description of the page's contents"
---
```
The significant keys in the YAML frontmatter are:
- `title` `(string)` - This is the title of the page that will be set in the HTML title.
- `description` `(string)` - This is a description of the page that will be set in the HTML description.
> ⚠Since `api` is a reserved directory within NextJS, all `/api/**` pages are listed under the `/pages/api-docs` path.
### Editing Sidebars
The structure of the sidebars are controlled by files in the [`/data` directory](data).
- Edit [this file](data/docs-navigation.js) to change the **docs** sidebar
- Edit [this file](data/api-navigation.js) to change the **api docs** sidebar
To nest sidebar items, you'll want to add a new `category` key/value accompanied by the appropriate embedded `content` values.
- `category` values will be **directory names** within the `pages` directory
- `content` values will be **file names** within their appropriately nested directory.
### Creating New Pages
There is currently a small bug with new page creation - if you create a new page and link it up via subnav data while the server is running, it will report an error saying the page was not found. This can be resolved by restarting the server.
### Changing the Release Version
To change the version of Packer displayed for download on the website, head over to `data/version.js` and change the number there. It's important to note that the version number must match a version that has been released and is live on `releases.hashicorp.com` -- if it does not, the website will be unable to fetch links to the binaries and will not compile. So this version number should be changed _only after a release_.
### Displaying a Prerelease
If there is a prerelease of any type that should be displayed on the downloads page, this can be done by editing `pages/downloads/index.jsx`. By default, the download component might look something like this:
```jsx
<ProductDownloader
product="Packer"
version={VERSION}
downloads={downloadData}
community="/resources"
/>
```
To add a prerelease, an extra `prerelease` property can be added to the component as such:
```jsx
<ProductDownloader
product="Packer"
version={VERSION}
downloads={downloadData}
community="/resources"
prerelease={{
type: 'release candidate', // the type of prerelease: beta, release candidate, etc.
name: 'v1.0.0', // the name displayed in text on the website
version: '1.0.0-rc1' // the actual version tag that was pushed to releases.hashicorp.com
}}
/>
```
This configuration would display something like the following text on the website, emphasis added to the configurable parameters:
```
A {{ release candidate }} for Packer {{ v1.0.0 }} is available! The release can be <a href='https://releases.hashicorp.com/packer/{{ 1.0.0-rc1 }}'>downloaded here</a>.
```
You may customize the parameters in any way you'd like. To remove a prerelease from the website, simply delete the `prerelease` paremeter from the above component.
### Deployment
This website is hosted on Netlify and configured to automatically deploy anytime you push code to the `stable-website` branch. Any time a pull request is submitted that changes files within the `website` folder, a deployment preview will appear in the github checks which can be used to validate the way docs changes will look live. Deployments from `stable-website` will look and behave the same way as deployment previews.

View File

@ -22,5 +22,5 @@
/intro/platforms.html /docs/builders/index.html 301!
/docs/templates/configuration-templates.html /docs/templates/engine.html 301!
/docs/machine-readable/* /docs/commands/index.html 301!
/docs/command-line/* /docs/commands/:splat 301!
/docs/extend/* /docs/extending/:splat 301!
/docs/command-line/* /docs/commands/:splat 200
/docs/extend/* /docs/extending/:splat 200

4
website/babel.config.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
presets: ['next/babel'],
plugins: ['import-glob-array']
}

View File

@ -0,0 +1,22 @@
import Subnav from '@hashicorp/react-subnav'
import subnavItems from '../../data/subnav'
import { useRouter } from 'next/router'
export default function PackerSubnav() {
const router = useRouter()
return (
<Subnav
titleLink={{
text: 'packer',
url: '/'
}}
ctaLinks={[
{ text: 'GitHub', url: 'https://www.github.com/hashicorp/packer' },
{ text: 'Download', url: '/downloads' }
]}
currentPath={router.pathname}
menuItemsAlign="right"
menuItems={subnavItems}
/>
)
}

View File

@ -1,115 +0,0 @@
set :base_url, "https://www.packer.io/"
activate :hashicorp do |h|
h.name = "packer"
h.version = "1.5.5"
h.github_slug = "hashicorp/packer"
h.website_root = "website"
end
helpers do
# Returns a segment tracking ID such that local development is not
# tracked to production systems.
def segmentId()
if (ENV['ENV'] == 'production')
'AjXdfmTTk1I9q9dfyePuDFHBrz1tCO3l'
else
'0EXTgkNx0Ydje2PGXVbRhpKKoe5wtzcE'
end
end
# Returns the FQDN of the image URL.
#
# @param [String] path
#
# @return [String]
def image_url(path)
File.join(base_url, image_path(path))
end
# Get the title for the page.
#
# @param [Middleman::Page] page
#
# @return [String]
def title_for(page)
if page && page.data.page_title
return "#{page.data.page_title} - Packer by HashiCorp"
end
"Packer by HashiCorp"
end
# Get the description for the page
#
# @param [Middleman::Page] page
#
# @return [String]
def description_for(page)
description = (page.data.description || "")
.gsub('"', '')
.gsub(/\n+/, ' ')
.squeeze(' ')
return escape_html(description)
end
# This helps by setting the "active" class for sidebar nav elements
# if the YAML frontmatter matches the expected value.
def sidebar_current(expected)
current = current_page.data.sidebar_current || ""
if current.start_with?(expected)
return " class=\"active\""
else
return ""
end
end
# Returns the id for this page.
# @return [String]
def body_id_for(page)
if !(name = page.data.sidebar_current).blank?
return "page-#{name.strip}"
end
if page.url == "/" || page.url == "/index.html"
return "page-home"
end
if !(title = page.data.page_title).blank?
return title
.downcase
.gsub('"', '')
.gsub(/[^\w]+/, '-')
.gsub(/_+/, '-')
.squeeze('-')
.squeeze(' ')
end
return ""
end
# Returns the list of classes for this page.
# @return [String]
def body_classes_for(page)
classes = []
if !(page.data.layout).blank?
classes << "layout-#{page.data.layout}"
end
if !(title = page.data.page_title).blank?
title = title
.downcase
.gsub('"', '')
.gsub(/[^\w]+/, '-')
.gsub(/_+/, '-')
.squeeze('-')
.squeeze(' ')
classes << "page-#{title}"
end
return classes.join(" ")
end
end
# Netlify redirects/headers
proxy '_redirects', 'netlify-redirects', ignore: true
proxy '_headers', 'netlify-headers', ignore: true

View File

@ -0,0 +1,13 @@
// The root folder for this documentation category is `pages/docs`
//
// - A string refers to the name of a file
// - A "category" value refers to the name of a directory
// - All directories must have an "index.mdx" file to serve as
// the landing page for the category
export default [
{
category: 'builders',
content: ['alicloud-ecs']
}
]

View File

@ -1,8 +0,0 @@
required:
<config parameter>:
type: <type>
docs: <doc string>
optional:
<config parameter>:
type: <type>
docs: <doc string>

View File

@ -0,0 +1,8 @@
// The root folder for this documentation category is `pages/guides`
//
// - A string refers to the name of a file
// - A "category" value refers to the name of a directory
// - All directories must have an "index.mdx" file to serve as
// the landing page for the category
export default []

View File

@ -0,0 +1,8 @@
// The root folder for this documentation category is `pages/intro`
//
// - A string refers to the name of a file
// - A "category" value refers to the name of a directory
// - All directories must have an "index.mdx" file to serve as
// the landing page for the category
export default []

18
website/data/subnav.js Normal file
View File

@ -0,0 +1,18 @@
export default [
{ text: 'Overview', url: '/', type: 'inbound' },
{
text: 'Intro',
url: '/intro',
type: 'inbound'
},
{
text: 'Docs',
url: '/docs',
type: 'inbound'
},
{
text: 'Community',
url: '/community',
type: 'inbound'
}
]

1
website/data/version.js Normal file
View File

@ -0,0 +1 @@
export default '1.5.4'

View File

@ -1,67 +0,0 @@
locals {
github_parts = ["${split("/", var.github_repo)}"]
github_full = "${var.github_repo}"
github_org = "${local.github_parts[0]}"
github_repo = "${local.github_parts[1]}"
}
/*
-------------------------------------------------------------------
GitHub Resources
-------------------------------------------------------------------
*/
provider "github" {
organization = "${local.github_org}"
version = "~> 2.0.0"
}
// Configure the repository with the dynamically created Netlify key.
resource "github_repository_deploy_key" "key" {
title = "Netlify"
repository = "${local.github_repo}"
key = "${netlify_deploy_key.key.public_key}"
read_only = false
}
// Create a webhook that triggers Netlify builds on push.
resource "github_repository_webhook" "main" {
repository = "${local.github_repo}"
events = ["delete", "push", "pull_request"]
configuration {
content_type = "json"
url = "https://api.netlify.com/hooks/github"
insecure_ssl = false
}
depends_on = ["netlify_site.main"]
}
/*
-------------------------------------------------------------------
Netlify Resources
-------------------------------------------------------------------
*/
provider "netlify" {
version = "~> 0.1.0"
}
// A new, unique deploy key for this specific website
resource "netlify_deploy_key" "key" {}
resource "netlify_site" "main" {
name = "${var.name}"
custom_domain = "${var.custom_site_domain}"
repo {
repo_branch = "${var.github_branch}"
command = "cd website && bundle && middleman build --verbose"
deploy_key_id = "${netlify_deploy_key.key.id}"
dir = "website/build"
provider = "github"
repo_path = "${local.github_full}"
}
}

View File

@ -1,19 +0,0 @@
variable "name" {
default = "packer-www"
description = "Name of the website in slug format."
}
variable "github_repo" {
default = "hashicorp/packer"
description = "GitHub repository of the provider in 'org/name' format."
}
variable "github_branch" {
default = "stable-website"
description = "GitHub branch which netlify will continuously deploy."
}
variable "custom_site_domain" {
default = "packer.io"
description = "The custom domain to use for the Netlify site."
}

37
website/layouts/docs.jsx Normal file
View File

@ -0,0 +1,37 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from '../data/docs-navigation.js'
import { frontMatter as data } from '../pages/docs/**/*.mdx'
import Head from 'next/head'
import Link from 'next/link'
function DocsLayoutWrapper(pageMeta) {
function DocsLayout(props) {
console.log(props)
return (
<DocsPage
{...props}
product="packer"
head={{
is: Head,
title: `${pageMeta.page_title} | Packer by HashiCorp`,
description: pageMeta.description,
siteName: 'Packer by HashiCorp'
}}
sidenav={{
Link,
category: 'docs',
currentPage: props.path,
data,
order
}}
resourceURL={`https://github.com/hashicorp/packer/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>
)
}
DocsLayout.getInitialProps = ({ asPath }) => ({ path: asPath })
return DocsLayout
}
export default DocsLayoutWrapper

View File

@ -0,0 +1,36 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from '../data/guides-navigation.js'
import { frontMatter as data } from '../pages/guides/**/*.mdx'
import Head from 'next/head'
import Link from 'next/link'
function GuidesLayoutWrapper(pageMeta) {
function GuidesLayout(props) {
return (
<DocsPage
{...props}
product="packer"
head={{
is: Head,
title: `${pageMeta.page_title} | Packer by HashiCorp`,
description: pageMeta.description,
siteName: 'Packer by HashiCorp'
}}
sidenav={{
Link,
category: 'guides',
currentPage: props.path,
data,
order
}}
resourceURL={`https://github.com/hashicorp/packer/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>
)
}
GuidesLayout.getInitialProps = ({ asPath }) => ({ path: asPath })
return GuidesLayout
}
export default GuidesLayoutWrapper

36
website/layouts/intro.jsx Normal file
View File

@ -0,0 +1,36 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from '../data/intro-navigation.js'
import { frontMatter as data } from '../pages/intro/**/*.mdx'
import Head from 'next/head'
import Link from 'next/link'
function IntroLayoutWrapper(pageMeta) {
function IntroLayout(props) {
return (
<DocsPage
{...props}
product="packer"
head={{
is: Head,
title: `${pageMeta.page_title} | Packer by HashiCorp`,
description: pageMeta.description,
siteName: 'Packer by HashiCorp'
}}
sidenav={{
Link,
category: 'guides',
currentPage: props.path,
data,
order
}}
resourceURL={`https://github.com/hashicorp/packer/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>
)
}
IntroLayout.getInitialProps = ({ asPath }) => ({ path: asPath })
return IntroLayout
}
export default IntroLayoutWrapper

17
website/lib/bugsnag.js Normal file
View File

@ -0,0 +1,17 @@
import React from 'react'
import bugsnag from '@bugsnag/js'
import bugsnagReact from '@bugsnag/plugin-react'
const apiKey =
typeof window === 'undefined'
? '61141296f1ba00a95a8788b7871e1184'
: '4fa712dfcabddd05da29fd1f5ea5a4c0'
const bugsnagClient = bugsnag({
apiKey,
releaseStage: process.env.NODE_ENV || 'development'
})
bugsnagClient.use(bugsnagReact, React)
export default bugsnagClient

View File

@ -0,0 +1,76 @@
const isProd = process.env.NODE_ENV === 'production'
const segmentWriteKey = isProd
? 'qW11yxgipKMsKFKQUCpTVgQUYftYsJj0'
: '0EXTgkNx0Ydje2PGXVbRhpKKoe5wtzcE'
// TODO: refactor into web components
let utilityServerRoot = isProd
? 'https://util.hashicorp.com'
: 'https://hashicorp-web-util-staging.herokuapp.com'
if (process.env.UTIL_SERVER) {
utilityServerRoot = process.env.UTIL_SERVER.replace(/\/$/, '')
}
// Consent manager configuration
export default {
version: 3,
container: '#consent-manager',
companyName: 'HashiCorp',
privacyPolicyLink: '/privacy',
segmentWriteKey: segmentWriteKey,
utilServerRoot: utilityServerRoot,
segmentServices: [
{
key: 'googleanalytics',
name: 'Google Analytics',
description:
'Google Analytics is a popular service for tracking web traffic. We use this data to determine what content our users find important so that we can dedicate more resources toward it.',
category: 'Analytics'
},
{
name: 'Hotjar',
description:
'Hotjar is a service that generates heatmaps of where users click on our sites. We use this information to ensure that our site is not confusing, and simple to use and navigate.',
category: 'Analytics'
},
{
name: 'LinkedIn Insight Tag',
description:
'This small script allows us to see how effective our linkedin campaigns are by showing which users have clicked through to our site.',
category: 'Analytics'
},
{
name: 'Marketo V2',
description:
'Marketo is a marketing automation tool that allows us to segment users into different categories based off of their behaviors. We use this information to provide tailored information to users in our email campaigns.'
}
],
categories: [
{
name: 'Functional',
description:
'Functional services provide a utility to the website, such as the ability to log in, or to get live support. Disabling any of these scripts will cause that utility to be missing from the site.'
},
{
name: 'Analytics',
description:
'Analytics services keep track of page traffic and user behavior while browsing the site. We use this data internally to improve the usability and performance of the site. Disabling any of these scripts makes it more difficult for us to understand how our site is being used, and slower to improve it.'
},
{
name: 'Email Marketing',
description:
'Email Marketing services track user behavior while browsing the site. We use this data internally in our marketing efforts to provide users contextually relevant information based off of their behaviors. Disabling any of these scripts makes it more difficult for us to provide you contextually relevant information.'
}
],
additionalServices: [
{
name: 'OptinMonster',
description:
"OptinMonster is a service that we use to show a prompt to sign up for our newsletter if it's perceived that you are interested in our content.",
category: 'Functional',
body: `var om598c8e3a6e43d,om598c8e3a6e43d_poll=function(){var r=0;return function(n,l){clearInterval(r),r=setInterval(n,l)}}();!function(e,t,n){if(e.getElementById(n)){om598c8e3a6e43d_poll(function(){if(window['om_loaded']){if(!om598c8e3a6e43d){om598c8e3a6e43d=new OptinMonsterApp();return om598c8e3a6e43d.init({"s":"35109.598c8e3a6e43d","staging":0,"dev":0,"beta":0});}}},25);return;}var d=false,o=e.createElement(t);o.id=n,o.src="https://a.optnmstr.com/app/js/api.min.js",o.async=true,o.onload=o.onreadystatechange=function(){if(!d){if(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"){try{d=om_loaded=true;om598c8e3a6e43d=new OptinMonsterApp();om598c8e3a6e43d.init({"s":"35109.598c8e3a6e43d","staging":0,"dev":0,"beta":0});o.onload=o.onreadystatechange=null;}catch(t){}}}};(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(o)}(document,"script","omapi-script");`
}
]
}

35
website/lib/polyfills.js Normal file
View File

@ -0,0 +1,35 @@
// If you run into issues with features missing in IE11, you likely need to
// make additions to this file for those features.
// See https://github.com/zloirock/core-js
import 'core-js/fn/array'
import 'core-js/fn/object/assign'
import 'core-js/fn/string/ends-with'
import 'core-js/fn/string/includes'
import 'core-js/fn/string/repeat'
import 'core-js/fn/string/starts-with'
import 'core-js/fn/symbol'
/* NodeList.forEach */
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach
}
/* Element.matches */
if (!Element.prototype.matches) {
Element.prototype.matches =
Element.prototype.msMatchesSelector ||
Element.prototype.webkitMatchesSelector
}
/* Element.closest */
if (!Element.prototype.closest) {
Element.prototype.closest = function(s) {
var el = this
do {
if (el.matches(s)) return el
el = el.parentElement || el.parentNode
} while (el !== null && el.nodeType === 1)
return null
}
}

18
website/netlify.toml Normal file
View File

@ -0,0 +1,18 @@
# This file sets configuration for Netlify
# ref: https://www.netlify.com/docs/netlify-toml-reference/
[build]
publish = "out"
command = "npm run static"
[context.production]
environment = { HASHI_ENV = "production", NODE_ENV = "production"}
[context.deploy-preview]
environment = { HASHI_ENV = "staging" }
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "SAMEORIGIN"

24
website/next.config.js Normal file
View File

@ -0,0 +1,24 @@
const withHashicorp = require('@hashicorp/nextjs-scripts')
const path = require('path')
module.exports = withHashicorp({
defaultLayout: true,
transpileModules: ['is-absolute-url', '@hashicorp/react-mega-nav'],
mdx: { resolveIncludes: path.join(__dirname, 'pages/partials') }
})({
experimental: {
css: true,
modern: true,
polyfillsOptimization: true,
rewrites: () => [
{
source: '/api/:path*',
destination: '/api-docs/:path*'
}
]
},
exportTrailingSlash: true,
env: {
HASHI_ENV: process.env.HASHI_ENV
}
})

19605
website/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

72
website/package.json Normal file
View File

@ -0,0 +1,72 @@
{
"name": "packer-docs",
"description": "Description of your website",
"version": "0.0.1",
"author": "HashiCorp",
"dependencies": {
"@bugsnag/js": "^6.5.2",
"@bugsnag/plugin-react": "^6.5.0",
"@hashicorp/nextjs-scripts": "^6.0.0-2",
"@hashicorp/react-alert": "^2.0.0",
"@hashicorp/react-button": "^2.1.6",
"@hashicorp/react-consent-manager": "^2.0.6",
"@hashicorp/react-content": "^2.2.0",
"@hashicorp/react-docs-page": "^0.1.1",
"@hashicorp/react-docs-sidenav": "^3.0.3",
"@hashicorp/react-docs-sitemap": "^1.0.0",
"@hashicorp/react-footer": "^3.1.11",
"@hashicorp/react-global-styles": "^4.0.10",
"@hashicorp/react-head": "^0.1.1",
"@hashicorp/react-hero": "^3.0.4",
"@hashicorp/react-image": "^2.0.1",
"@hashicorp/react-inline-svg": "^1.0.0",
"@hashicorp/react-mega-nav": "^4.0.1-2",
"@hashicorp/react-product-downloader": "^3.0.2",
"@hashicorp/react-section-header": "^2.0.0",
"@hashicorp/react-subnav": "^2.2.0",
"@hashicorp/react-text-and-content": "^4.0.6",
"@hashicorp/react-text-split": "^0.2.3",
"@hashicorp/react-text-split-with-code": "0.0.6",
"@hashicorp/react-text-split-with-image": "^1.2.3",
"@hashicorp/react-vertical-text-block-list": "^2.0.1",
"babel-plugin-import-glob-array": "^0.2.0",
"highlight.js": "^9.18.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-optipng": "^7.1.0",
"imagemin-svgo": "^7.1.0",
"isomorphic-unfetch": "^3.0.0",
"marked": "^0.7.0",
"next": "9.3.1",
"nprogress": "^0.2.0",
"nuka-carousel": "^4.6.6",
"react": "^16.13.0",
"react-device-detect": "^1.11.14",
"react-dom": "^16.13.0",
"slugify": "^1.4.0",
"stringify-object": "^3.3.0"
},
"devDependencies": {
"dart-linkcheck": "^2.0.12",
"glob": "^7.1.6",
"husky": "^4.2.3",
"inquirer": "^7.1.0",
"prettier": "^1.19.1"
},
"husky": {
"hooks": {
"pre-commit": "next-hashicorp precommit"
}
},
"main": "index.js",
"scripts": {
"build": "node --max-old-space-size=2048 ./node_modules/.bin/next build",
"dynamic": "NODE_ENV=production next build && next start",
"export": "node --max-old-space-size=2048 ./node_modules/.bin/next export",
"format": "next-hashicorp format",
"generate:component": "next-hashicorp generate component",
"lint": "next-hashicorp lint",
"start": "rm -rf .next/cache/next-babel-loader/ && next dev",
"static": "npm run build && npm run export && cp _redirects out/.",
"linkcheck": "linkcheck https://www.packer.io"
}
}

85
website/pages/_app.js Normal file
View File

@ -0,0 +1,85 @@
import './style.css'
import App from 'next/app'
import NProgress from 'nprogress'
import Router from 'next/router'
import ProductSubnav from '../components/subnav'
import MegaNav from '@hashicorp/react-mega-nav'
import Footer from '@hashicorp/react-footer'
import { ConsentManager, open } from '@hashicorp/react-consent-manager'
import consentManagerConfig from '../lib/consent-manager-config'
import bugsnagClient from '../lib/bugsnag'
import Error from './_error'
import Head from 'next/head'
import HashiHead from '@hashicorp/react-head'
Router.events.on('routeChangeStart', NProgress.start)
Router.events.on('routeChangeError', NProgress.done)
Router.events.on('routeChangeComplete', url => {
setTimeout(() => window.analytics.page(url), 0)
NProgress.done()
})
// Bugsnag
const ErrorBoundary = bugsnagClient.getPlugin('react')
class NextApp extends App {
static async getInitialProps({ Component, ctx }) {
let pageProps = {}
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
} else if (Component.isMDXComponent) {
// fix for https://github.com/mdx-js/mdx/issues/382
const mdxLayoutComponent = Component({}).props.originalType
if (mdxLayoutComponent.getInitialProps) {
pageProps = await mdxLayoutComponent.getInitialProps(ctx)
}
}
return { pageProps }
}
render() {
const { Component, pageProps } = this.props
return (
<ErrorBoundary FallbackComponent={Error}>
<HashiHead
is={Head}
title="Packer by HashiCorp"
siteName="Packer by HashiCorp"
description="Packer is a free and open source tool for creating golden images for multiple
platforms from a single source configuration."
image="https://www.packer.io/img/og-image.png"
stylesheet={[
{ href: '/css/nprogress.css' },
{
href:
'https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&display=swap'
}
]}
icon={[{ href: '/favicon.ico' }]}
preload={[
{ href: '/fonts/klavika/medium.woff2', as: 'font' },
{ href: '/fonts/gilmer/light.woff2', as: 'font' },
{ href: '/fonts/gilmer/regular.woff2', as: 'font' },
{ href: '/fonts/gilmer/medium.woff2', as: 'font' },
{ href: '/fonts/gilmer/bold.woff2', as: 'font' },
{ href: '/fonts/metro-sans/book.woff2', as: 'font' },
{ href: '/fonts/metro-sans/regular.woff2', as: 'font' },
{ href: '/fonts/metro-sans/semi-bold.woff2', as: 'font' },
{ href: '/fonts/metro-sans/bold.woff2', as: 'font' },
{ href: '/fonts/dejavu/mono.woff2', as: 'font' }
]}
/>
<MegaNav product="Packer" />
<ProductSubnav />
<Component {...pageProps} />
<Footer openConsentManager={open} />
<ConsentManager {...consentManagerConfig} />
</ErrorBoundary>
)
}
}
export default NextApp

View File

@ -0,0 +1,27 @@
import Document, { Head, Main, NextScript } from 'next/document'
import HashiHead from '@hashicorp/react-head'
export default class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
return { ...initialProps }
}
render() {
return (
<html>
<HashiHead is={Head} />
<body>
<Main />
<NextScript />
<script
noModule
dangerouslySetInnerHTML={{
__html: `window.MSInputMethodContext && document.documentMode && document.write('<script src="/ie-custom-properties.js"><\\x2fscript>');`
}}
/>
</body>
</html>
)
}
}

13
website/pages/_error.jsx Normal file
View File

@ -0,0 +1,13 @@
import React from 'react'
import ErrorPage from 'next/error'
import bugsnagClient from '../lib/bugsnag'
export default class Page extends React.Component {
static async getInitialProps(ctx) {
if (ctx.err) bugsnagClient.notify(ctx.err)
return ErrorPage.getInitialProps(ctx)
}
render() {
return <ErrorPage statusCode={this.props.statusCode || '¯\\_(ツ)_/¯'} />
}
}

View File

@ -1,9 +1,6 @@
---
layout: "community"
page_title: "Community vs HashiCorp Maintained Plugins"
sidebar_current: "community-or-hashicorp-plugins"
description: |-
Packer maintains these core plugins.
page_title: Community vs HashiCorp Maintained Plugins
description: Packer maintains these core plugins.
---
# HashiCorp Maintained Plugins

View File

@ -1,7 +1,5 @@
---
layout: "community"
page_title: "Download Packer Community Projects"
sidebar_current: "community-tools"
page_title: Download Packer Community Projects
description: |-
Packer has a vibrant community of contributors who have built a number of
great tools on top of Packer. There are also quite a few projects
@ -27,9 +25,9 @@ If you have built a plugin and would like to add it to this community list,
please make a pull request to the website so that we can document your
contribution here!
<%= partial "partials/builders/community_builders" %>
@include "builders/community_builders"
<%= partial "partials/provisioners/community_provisioners" %>
@include "provisioners/community_provisioners"
## Templates
@ -52,10 +50,10 @@ contribution here!
- [cbednarski/packer-ubuntu](https://github.com/cbednarski/packer-ubuntu) -
Ubuntu LTS Virtual Machines for Vagrant
* [geerlingguy/packer-ubuntu-1604](https://github.com/geerlingguy/packer-ubuntu-1604)
- [geerlingguy/packer-ubuntu-1604](https://github.com/geerlingguy/packer-ubuntu-1604)
\- Ubuntu 16.04 minimal Vagrant Box using Ansible provisioner
* [jakobadam/packer-qemu-templates](https://github.com/jakobadam/packer-qemu-templates)
- [jakobadam/packer-qemu-templates](https://github.com/jakobadam/packer-qemu-templates)
\- QEMU templates for various operating systems
* [lucidone/baseliner](https://git.sr.ht/~lucidone/baseliner) - Example of using
@ -64,11 +62,8 @@ contribution here!
## Wrappers
- [packer-config](https://github.com/ianchesal/packer-config) - a Ruby model that lets you build Packer configurations in Ruby
- [racker](https://github.com/aspring/racker) - an opinionated Ruby DSL for generating Packer templates
- [packerlicious](https://github.com/mayn/packerlicious) - a python library for generating Packer templates
- [packer.py](https://github.com/mayn/packer.py) - a python library for executing Packer CLI commands
## Other

View File

@ -0,0 +1,51 @@
import VerticalTextBlockList from '@hashicorp/react-vertical-text-block-list'
import SectionHeader from '@hashicorp/react-section-header'
import Head from 'next/head'
export default function CommunityPage() {
return (
<div id="community">
<Head>
<title key="title">Community | Packer by HashiCorp</title>
</Head>
<SectionHeader
headline="Community"
description="Packer is an open source project with a growing community. There are active, dedicated users willing to help you through various mediums."
use_h1={true}
/>
<VerticalTextBlockList
data={[
{
header: 'IRC',
body: '`#packer-tool` on Freenode'
},
{
header: 'Announcement List',
body:
'[HashiCorp Announcement Google Group](https://groups.google.com/group/hashicorp-announce)'
},
{
header: 'Discussion List',
body:
'[Packer Google Group](https://groups.google.com/group/packer-tool)'
},
{
header: 'Community Forum',
body:
'[Packer Community Forum](https://discuss.hashicorp.com/c/packer)'
},
{
header: 'Bug Tracker',
body:
'[Issue tracker on GitHub](https://github.com/hashicorp/packer/issues). Please only use this for reporting bugs. Do not ask for general help here. Use IRC or the mailing list for that.'
},
{
header: 'Training',
body:
'Paid [HashiCorp training courses](https://www.hashicorp.com/training) are also available in a city near you. Private training courses are also available.'
}
]}
/>
</div>
)
}

View File

@ -0,0 +1,61 @@
---
description: >
There are a handful of terms used throughout the Packer documentation where
the
meaning may not be immediately obvious if you haven't used Packer before.
Luckily, there are relatively few. This page documents all the terminology
required to understand and use Packer. The terminology is in alphabetical
order
for quick referencing.
layout: docs
page_title: Terminology
---
# Packer Terminology
There are a handful of terms used throughout the Packer documentation where the
meaning may not be immediately obvious if you haven't used Packer before.
Luckily, there are relatively few. This page documents all the terminology
required to understand and use Packer. The terminology is in alphabetical order
for quick referencing.
- `Artifacts` are the results of a single build, and are usually a set of IDs
or files to represent a machine image. Every builder produces a single
artifact. As an example, in the case of the Amazon EC2 builder, the
artifact is a set of AMI IDs (one per region). For the VMware builder, the
artifact is a directory of files comprising the created virtual machine.
- `Builds` are a single task that eventually produces an image for a single
platform. Multiple builds run in parallel. Example usage in a sentence:
"The Packer build produced an AMI to run our web application." Or: "Packer
is running the builds now for VMware, AWS, and VirtualBox."
- `Builders` are components of Packer that are able to create a machine image
for a single platform. Builders read in some configuration and use that to
run and generate a machine image. A builder is invoked as part of a build
in order to create the actual resulting images. Example builders include
VirtualBox, VMware, and Amazon EC2. Builders can be created and added to
Packer in the form of plugins.
- `Commands` are sub-commands for the `packer` program that perform some job.
An example command is "build", which is invoked as `packer build`. Packer
ships with a set of commands out of the box in order to define its
command-line interface.
- `Post-processors` are components of Packer that take the result of a
builder or another post-processor and process that to create a new
artifact. Examples of post-processors are compress to compress artifacts,
upload to upload artifacts, etc.
- `Provisioners` are components of Packer that install and configure software
within a running machine prior to that machine being turned into a static
image. They perform the major work of making the image contain useful
software. Example provisioners include shell scripts, Chef, Puppet, etc.
- `Templates` are JSON files which define one or more builds by configuring
the various components of Packer. Packer is able to read a template and use
that information to create multiple machine images in parallel.

View File

@ -0,0 +1,88 @@
---
description: |
The `alicloud-ecs` Packer builder plugin provide the capability to build
customized images based on an existing base images.
layout: docs
page_title: Alicloud Image Builder
sidebar_current: docs-builders-alicloud-ecs
---
# Alicloud Image Builder
Type: `alicloud-ecs`
The `alicloud-ecs` Packer builder plugin provide the capability to build
customized images based on an existing base images.
## Configuration Reference
The following configuration options are available for building Alicloud images.
In addition to the options listed here, a
[communicator](../templates/communicator.html) can be configured for this
builder.
### Required:
@include 'partials/builder/alicloud/ecs/RunConfig-required.mdx'
@include 'partials/builder/alicloud/ecs/AlicloudImageConfig-required.mdx'
### Optional:
@include 'partials/builder/alicloud/ecs/AlicloudAccessConfig-not-required.mdx'
@include 'partials/builder/alicloud/ecs/AlicloudDiskDevice-not-required.mdx'
@include 'partials/builder/alicloud/ecs/AlicloudDiskDevices-not-required.mdx'
@include 'partials/builder/alicloud/ecs/RunConfig-not-required.mdx'
@include 'partials/builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx'
- `temporary_key_pair_name` (string) - The name of the temporary key pair to
generate. By default, Packer generates a name that looks like
`packer_<UUID>`, where &lt;UUID&gt; is a 36 character unique identifier.
## Basic Example
Here is a basic example for Alicloud.
```json
{
"variables": {
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
},
"builders": [
{
"type": "alicloud-ecs",
"access_key": "{{user `access_key`}}",
"secret_key": "{{user `secret_key`}}",
"region": "cn-beijing",
"image_name": "packer_test2",
"source_image": "centos_7_04_64_20G_alibase_201701015.vhd",
"ssh_username": "root",
"instance_type": "ecs.n1.tiny",
"io_optimized": "true",
"internet_charge_type": "PayByTraffic",
"image_force_delete": "true"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["sleep 30", "yum install redis.x86_64 -y"]
}
]
}
```
\~&gt; Note: Images can become deprecated after a while; run
`aliyun ecs DescribeImages` to find one that exists.
\~&gt; Note: Since WinRM is closed by default in the system image. If you are
planning to use Windows as the base image, you need enable it by userdata in
order to connect to the instance, check
[alicloud_windows.json](https://github.com/hashicorp/packer/tree/master/examples/alicloud/basic/alicloud_windows.json)
and
[winrm_enable_userdata.ps1](https://github.com/hashicorp/packer/tree/master/examples/alicloud/basic/winrm_enable_userdata.ps1)
for details.
See the
[examples/alicloud](https://github.com/hashicorp/packer/tree/master/examples/alicloud)
folder in the packer project for more examples.

View File

@ -1,12 +1,16 @@
---
description: |
The amazon-chroot Packer builder is able to create Amazon AMIs backed by an EBS
volume as the root device. For more information on the difference between
instance storage and EBS-backed instances, storage for the root device section
in the EC2 documentation.
description: >
The amazon-chroot Packer builder is able to create Amazon AMIs backed by an
EBS
volume as the root device. For more information on the difference between
instance storage and EBS-backed instances, storage for the root device section
in the EC2 documentation.
layout: docs
page_title: 'Amazon chroot - Builders'
sidebar_current: 'docs-builders-amazon-chroot'
page_title: Amazon chroot - Builders
sidebar_current: docs-builders-amazon-chroot
---
# AMI Builder (chroot)
@ -28,7 +32,7 @@ the extra fast build.
Packer, we recommend starting with the [amazon-ebs
builder](/docs/builders/amazon-ebs.html), which is much easier to use.
The builder does *not* manage AMIs. Once it creates an AMI and stores it in
The builder does _not_ manage AMIs. Once it creates an AMI and stores it in
your account, it is up to you to use, delete, etc., the AMI.
### How Does it Work?
@ -60,10 +64,11 @@ necessary for this build to succeed and can be found further down the page.
#### Required:
<%= partial "partials/builder/amazon/chroot/Config-required" %>
@include 'partials/builder/amazon/chroot/Config-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/chroot/Config-not-required" %>
@include 'partials/builder/amazon/chroot/Config-not-required.mdx'
## General Common Configuration Reference
@ -74,31 +79,32 @@ builders.
#### Required:
<%= partial "partials/builder/amazon/common/AMIConfig-required" %>
@include 'partials/builder/amazon/common/AMIConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AMIConfig-not-required" %>
@include 'partials/builder/amazon/common/AMIConfig-not-required.mdx'
### Block Devices Configuration
Block devices can be nested in the
[ami_block_device_mappings](#ami_block_device_mappings) array.
<%= partial "partials/builder/amazon/common/BlockDevice" %>
@include 'partials/builder/amazon/common/BlockDevice.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/BlockDevice-not-required" %>
@include 'partials/builder/amazon/common/BlockDevice-not-required.mdx'
### Access Config Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
@include 'partials/builder/amazon/common/AccessConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
@include 'partials/builder/amazon/common/AccessConfig-not-required.mdx'
## Basic Example
@ -120,11 +126,11 @@ The `chroot_mounts` configuration can be used to mount specific devices within
the chroot. By default, the following additional mounts are added into the
chroot by Packer:
- `/proc` (proc)
- `/sys` (sysfs)
- `/dev` (bind to real `/dev`)
- `/dev/pts` (devpts)
- `/proc/sys/fs/binfmt_misc` (binfmt\_misc)
- `/proc` (proc)
- `/sys` (sysfs)
- `/dev` (bind to real `/dev`)
- `/dev/pts` (devpts)
- `/proc/sys/fs/binfmt_misc` (binfmt_misc)
These default mounts are usually good enough for anyone and are sane defaults.
However, if you want to change or add the mount points, you may using the
@ -143,16 +149,16 @@ mounts `/proc` and `/dev`:
`chroot_mounts` is a list of a 3-tuples of strings. The three components of the
3-tuple, in order, are:
- The filesystem type. If this is "bind", then Packer will properly bind the
filesystem to another mount point.
- The filesystem type. If this is "bind", then Packer will properly bind the
filesystem to another mount point.
- The source device.
- The source device.
- The mount directory.
- The mount directory.
## Parallelism
A quick note on parallelism: it is perfectly safe to run multiple *separate*
A quick note on parallelism: it is perfectly safe to run multiple _separate_
Packer processes with the `amazon-chroot` builder on the same EC2 instance. In
fact, this is recommended as a way to push the most performance out of your AMI
builds.
@ -174,7 +180,7 @@ file which will prevent packages installed by your provisioners from starting
services:
```json
{
({
"type": "shell",
"inline": [
"echo '#!/bin/sh' > /usr/sbin/policy-rc.d",
@ -182,15 +188,12 @@ services:
"chmod a+x /usr/sbin/policy-rc.d"
]
},
// ...
{
"type": "shell",
"inline": [
"rm -f /usr/sbin/policy-rc.d"
]
}
"inline": ["rm -f /usr/sbin/policy-rc.d"]
})
```
### Ansible provisioner
@ -211,7 +214,7 @@ A working example for mounting an NVMe device is below:
```json
{
"variables": {
"region" : "us-east-2"
"region": "us-east-2"
},
"builders": [
{
@ -219,9 +222,9 @@ A working example for mounting an NVMe device is below:
"region": "{{user `region`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "amzn-ami-hvm-*",
"root-device-type": "ebs"
"virtualization-type": "hvm",
"name": "amzn-ami-hvm-*",
"root-device-type": "ebs"
},
"owners": ["137112412989"],
"most_recent": true
@ -282,24 +285,24 @@ provisioning commands to install the os and bootloader.
In configuration directives marked as a template engine above, the following
variables are available:
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
## Build function template engine variables
For the build function of [template engine](/docs/templates/engine.html), the following
variables are available:
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `Device` - Root device path.
- `MountPath` - Device mounting path.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `Device` - Root device path.
- `MountPath` - Device mounting path.

View File

@ -1,12 +1,12 @@
---
description: |
The amazon-ebs Packer builder is able to create Amazon AMIs backed by EBS
volumes for use in EC2. For more information on the difference between
EBS-backed instances and instance-store backed instances, see the storage for
the root device section in the EC2 documentation.
The amazon-ebs Packer builder is able to create Amazon AMIs backed by EBS
volumes for use in EC2. For more information on the difference between
EBS-backed instances and instance-store backed instances, see the storage for
the root device section in the EC2 documentation.
layout: docs
page_title: 'Amazon EBS - Builders'
sidebar_current: 'docs-builders-amazon-ebsbacked'
page_title: Amazon EBS - Builders
sidebar_current: docs-builders-amazon-ebsbacked
---
# AMI Builder (EBS backed)
@ -26,7 +26,7 @@ keypairs, security group rules, etc. that provide it temporary access to the
instance while the image is being created. This simplifies configuration quite
a bit.
The builder does *not* manage AMIs. Once it creates an AMI and stores it in
The builder does _not_ manage AMIs. Once it creates an AMI and stores it in
your account, it is up to you to use, delete, etc. the AMI.
-&gt; **Note:** Temporary resources are, by default, all created with the
@ -47,38 +47,37 @@ necessary for this build to succeed and can be found further down the page.
#### Optional:
<%= partial "partials/builder/amazon/ebs/Config-not-required" %>
@include 'partials/builder/amazon/ebs/Config-not-required.mdx'
### AMI Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AMIConfig-required" %>
@include 'partials/builder/amazon/common/AMIConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AMIConfig-not-required" %>
@include 'partials/builder/amazon/common/AMIConfig-not-required.mdx'
### Access Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
@include 'partials/builder/amazon/common/AccessConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
@include 'partials/builder/amazon/common/AccessConfig-not-required.mdx'
### Run Configuration
#### Required:
<%= partial "partials/builder/amazon/common/RunConfig-required" %>
@include 'partials/builder/amazon/common/RunConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/RunConfig-not-required" %>
@include 'partials/builder/amazon/common/RunConfig-not-required.mdx'
### Block Devices Configuration
@ -86,18 +85,18 @@ Block devices can be nested in the
[ami_block_device_mappings](#ami_block_device_mappings) or the
[launch_block_device_mappings](#launch_block_device_mappings) array.
<%= partial "partials/builder/amazon/common/BlockDevice" %>
@include 'partials/builder/amazon/common/BlockDevice.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/BlockDevice-not-required" %>
@include 'partials/builder/amazon/common/BlockDevice-not-required.mdx'
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/helper/communicator/SSH-not-required.mdx'
## Basic Example
@ -187,25 +186,25 @@ configuration of `launch_block_device_mappings` will expand the root volume
In configuration directives marked as a template engine above, the following
variables are available:
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
## Build function template engine variables
For the build function of [template engine](/docs/templates/engine.html), the following
variables are available:
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
## Tag Example
@ -342,14 +341,12 @@ be easily added to the provisioner section.
```json
{
"type": "powershell",
"inline": [
"C:/ProgramData/Amazon/EC2-Windows/Launch/Scripts/InitializeInstance.ps1 -Schedule",
"C:/ProgramData/Amazon/EC2-Windows/Launch/Scripts/SysprepInstance.ps1 -NoShutdown"
]
"type": "powershell",
"inline": [
"C:/ProgramData/Amazon/EC2-Windows/Launch/Scripts/InitializeInstance.ps1 -Schedule",
"C:/ProgramData/Amazon/EC2-Windows/Launch/Scripts/SysprepInstance.ps1 -NoShutdown"
]
}
```
<%= partial "partials/builders/aws-ssh-differentiation-table" %>
@include 'partials/builders/aws-ssh-differentiation-table.mdx'

View File

@ -1,10 +1,12 @@
---
description: |
The amazon-ebssurrogate Packer builder is like the chroot builder, but does not
require running inside an EC2 instance.
description: >
The amazon-ebssurrogate Packer builder is like the chroot builder, but does
not
require running inside an EC2 instance.
layout: docs
page_title: 'Amazon EBS Surrogate - Builders'
sidebar_current: 'docs-builders-amazon-ebssurrogate'
page_title: Amazon EBS Surrogate - Builders
sidebar_current: docs-builders-amazon-ebssurrogate
---
# EBS Surrogate Builder
@ -37,93 +39,90 @@ necessary for this build to succeed and can be found further down the page.
### Required:
<%= partial "partials/builder/amazon/ebssurrogate/Config-required" %>
@include 'partials/builder/amazon/ebssurrogate/Config-required.mdx'
### Optional:
<%= partial "partials/builder/amazon/ebssurrogate/Config-not-required" %>
@include 'partials/builder/amazon/ebssurrogate/Config-not-required.mdx'
### AMI Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AMIConfig-required" %>
@include 'partials/builder/amazon/common/AMIConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AMIConfig-not-required" %>
@include 'partials/builder/amazon/common/AMIConfig-not-required.mdx'
### Access Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
@include 'partials/builder/amazon/common/AccessConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
@include 'partials/builder/amazon/common/AccessConfig-not-required.mdx'
### Run Configuration
#### Required:
<%= partial "partials/builder/amazon/common/RunConfig-required" %>
@include 'partials/builder/amazon/common/RunConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/RunConfig-not-required" %>
@include 'partials/builder/amazon/common/RunConfig-not-required.mdx'
### Block Devices Configuration
Block devices can be nested in the
[ami_block_device_mappings](#ami_block_device_mappings) array.
<%= partial "partials/builder/amazon/common/BlockDevice" %>
@include 'partials/builder/amazon/common/BlockDevice.mdx'
#### Optional only for [launch_block_device_mappings](#launch_block_device_mappings)
<%= partial "partials/builder/amazon/ebssurrogate/BlockDevice-not-required" %>
@include 'partials/builder/amazon/ebssurrogate/BlockDevice-not-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/BlockDevice-not-required" %>
@include 'partials/builder/amazon/common/BlockDevice-not-required.mdx'
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/helper/communicator/SSH-not-required.mdx'
## Basic Example
```json
{
"type" : "amazon-ebssurrogate",
"secret_key" : "YOUR SECRET KEY HERE",
"access_key" : "YOUR KEY HERE",
"region" : "us-east-1",
"ssh_username" : "ubuntu",
"instance_type" : "t2.medium",
"source_ami" : "ami-40d28157",
"launch_block_device_mappings" : [
{
"volume_type" : "gp2",
"device_name" : "/dev/xvdf",
"delete_on_termination" : false,
"volume_size" : 10
}
],
"ami_root_device": {
"source_device_name": "/dev/xvdf",
"device_name": "/dev/xvda",
"delete_on_termination": true,
"volume_size": 16,
"volume_type": "gp2"
}
"type": "amazon-ebssurrogate",
"secret_key": "YOUR SECRET KEY HERE",
"access_key": "YOUR KEY HERE",
"region": "us-east-1",
"ssh_username": "ubuntu",
"instance_type": "t2.medium",
"source_ami": "ami-40d28157",
"launch_block_device_mappings": [
{
"volume_type": "gp2",
"device_name": "/dev/xvdf",
"delete_on_termination": false,
"volume_size": 10
}
],
"ami_root_device": {
"source_device_name": "/dev/xvdf",
"device_name": "/dev/xvda",
"delete_on_termination": true,
"volume_size": 16,
"volume_type": "gp2"
}
}
```
@ -149,25 +148,25 @@ You can use this information to access the instance as it is running.
In configuration directives marked as a template engine above, the following
variables are available:
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
## Build function template engine variables
For the build function of [template engine](/docs/templates/engine.html), the following
variables are available:
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
-&gt; **Note:** Packer uses pre-built AMIs as the source for building images.
These source AMIs may include volumes that are not flagged to be destroyed on
@ -175,5 +174,4 @@ termination of the instance building the new image. In addition to those
volumes created by this builder, any volumes in the source AMI which are not
marked for deletion on termination will remain in your account.
<%= partial "partials/builders/aws-ssh-differentiation-table" %>
@include 'partials/builders/aws-ssh-differentiation-table.mdx'

View File

@ -1,10 +1,10 @@
---
description: |
The amazon-ebsvolume Packer builder is like the EBS builder, but is
intended to create EBS volumes rather than a machine image.
The amazon-ebsvolume Packer builder is like the EBS builder, but is
intended to create EBS volumes rather than a machine image.
layout: docs
page_title: 'Amazon EBS Volume - Builders'
sidebar_current: 'docs-builders-amazon-ebsvolume'
page_title: Amazon EBS Volume - Builders
sidebar_current: docs-builders-amazon-ebsvolume
---
# EBS Volume Builder
@ -24,7 +24,7 @@ This is all done in your own AWS account. The builder will create temporary key
pairs, security group rules, etc. that provide it temporary access to the
instance while the image is being created.
The builder does *not* manage EBS Volumes. Once it creates volumes and stores
The builder does _not_ manage EBS Volumes. Once it creates volumes and stores
it in your account, it is up to you to use, delete, etc. the volumes.
-&gt; **Note:** Temporary resources are, by default, all created with the
@ -45,102 +45,102 @@ necessary for this build to succeed and can be found further down the page.
### Optional:
<%= partial "partials/builder/amazon/ebsvolume/Config-not-required" %>
@include 'partials/builder/amazon/ebsvolume/Config-not-required.mdx'
### Access Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
@include 'partials/builder/amazon/common/AccessConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
@include 'partials/builder/amazon/common/AccessConfig-not-required.mdx'
### AMI Configuration
#### Optional:
- `snapshot_groups` (array of strings) - A list of groups that have access to
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
- `snapshot_groups` (array of strings) - A list of groups that have access to
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
- `snapshot_users` (array of strings) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the AMI has permissions to create
volumes from the backing snapshot(s).
- `snapshot_users` (array of strings) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the AMI has permissions to create
volumes from the backing snapshot(s).
### Block Devices Configuration
Block devices can be nested in the
[ebs_volumes](#ebs_volumes) array.
<%= partial "partials/builder/amazon/common/BlockDevice" %>
@include 'partials/builder/amazon/common/BlockDevice.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/BlockDevice-not-required" %>
<%= partial "partials/builder/amazon/ebsvolume/BlockDevice-not-required" %>
@include 'partials/builder/amazon/common/BlockDevice-not-required.mdx'
@include 'partials/builder/amazon/ebsvolume/BlockDevice-not-required.mdx'
### Run Configuration
#### Required:
<%= partial "partials/builder/amazon/common/RunConfig-required" %>
@include 'partials/builder/amazon/common/RunConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/RunConfig-not-required" %>
@include 'partials/builder/amazon/common/RunConfig-not-required.mdx'
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/helper/communicator/SSH-not-required.mdx'
## Basic Example
```json
{
"type" : "amazon-ebsvolume",
"secret_key" : "YOUR SECRET KEY HERE",
"access_key" : "YOUR KEY HERE",
"region" : "us-east-1",
"ssh_username" : "ubuntu",
"instance_type" : "t2.medium",
"source_ami" : "ami-40d28157",
"ebs_volumes" : [
"type": "amazon-ebsvolume",
"secret_key": "YOUR SECRET KEY HERE",
"access_key": "YOUR KEY HERE",
"region": "us-east-1",
"ssh_username": "ubuntu",
"instance_type": "t2.medium",
"source_ami": "ami-40d28157",
"ebs_volumes": [
{
"volume_type" : "gp2",
"device_name" : "/dev/xvdf",
"delete_on_termination" : false,
"tags" : {
"zpool" : "data",
"Name" : "Data1"
"volume_type": "gp2",
"device_name": "/dev/xvdf",
"delete_on_termination": false,
"tags": {
"zpool": "data",
"Name": "Data1"
},
"volume_size" : 10
"volume_size": 10
},
{
"volume_type" : "gp2",
"device_name" : "/dev/xvdg",
"tags" : {
"zpool" : "data",
"Name" : "Data2"
"volume_type": "gp2",
"device_name": "/dev/xvdg",
"tags": {
"zpool": "data",
"Name": "Data2"
},
"delete_on_termination" : false,
"volume_size" : 10
"delete_on_termination": false,
"volume_size": 10
},
{
"volume_size" : 10,
"tags" : {
"Name" : "Data3",
"zpool" : "data"
"volume_size": 10,
"tags": {
"Name": "Data3",
"zpool": "data"
},
"delete_on_termination" : false,
"device_name" : "/dev/xvdh",
"volume_type" : "gp2"
"delete_on_termination": false,
"device_name": "/dev/xvdh",
"volume_type": "gp2"
}
]
}
@ -168,16 +168,16 @@ You can use this information to access the instance as it is running.
In configuration directives marked as a template engine above, the following
variables are available:
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
-&gt; **Note:** Packer uses pre-built AMIs as the source for building images.
These source AMIs may include volumes that are not flagged to be destroyed on
@ -190,9 +190,8 @@ marked for deletion on termination will remain in your account.
For the build function of [template engine](/docs/templates/engine.html), the following
variables are available:
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
<%= partial "partials/builders/aws-ssh-differentiation-table" %>
@include 'partials/builders/aws-ssh-differentiation-table.mdx'

View File

@ -1,12 +1,16 @@
---
description: |
The amazon-instance Packer builder is able to create Amazon AMIs backed by
instance storage as the root device. For more information on the difference
between instance storage and EBS-backed instances, see the storage for the root
device section in the EC2 documentation.
description: >
The amazon-instance Packer builder is able to create Amazon AMIs backed by
instance storage as the root device. For more information on the difference
between instance storage and EBS-backed instances, see the storage for the
root
device section in the EC2 documentation.
layout: docs
page_title: 'Amazon instance-store - Builders'
sidebar_current: 'docs-builders-amazon-instance'
page_title: Amazon instance-store - Builders
sidebar_current: docs-builders-amazon-instance
---
# AMI Builder (instance-store)
@ -26,7 +30,7 @@ AWS account. This builder will create temporary key pairs, security group
rules, etc. that provide it temporary access to the instance while the image is
being created. This simplifies configuration quite a bit.
This builder does *not* manage AMIs. Once it creates an AMI and stores it in
This builder does _not_ manage AMIs. Once it creates an AMI and stores it in
your account, it is up to you to use, delete, etc. the AMI.
-&gt; **Note:** Temporary resources are, by default, all created with the
@ -55,42 +59,41 @@ necessary for this build to succeed and can be found further down the page.
### Required:
<%= partial "partials/builder/amazon/instance/Config-required" %>
@include 'partials/builder/amazon/instance/Config-required.mdx'
### Optional:
<%= partial "partials/builder/amazon/instance/Config-not-required" %>
@include 'partials/builder/amazon/instance/Config-not-required.mdx'
### AMI Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AMIConfig-required" %>
@include 'partials/builder/amazon/common/AMIConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AMIConfig-not-required" %>
@include 'partials/builder/amazon/common/AMIConfig-not-required.mdx'
### Access Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
@include 'partials/builder/amazon/common/AccessConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
@include 'partials/builder/amazon/common/AccessConfig-not-required.mdx'
### Run Configuration
#### Required:
<%= partial "partials/builder/amazon/common/RunConfig-required" %>
@include 'partials/builder/amazon/common/RunConfig-required.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/RunConfig-not-required" %>
@include 'partials/builder/amazon/common/RunConfig-not-required.mdx'
### Block Devices Configuration
@ -98,18 +101,18 @@ Block devices can be nested in the
[ami_block_device_mappings](#ami_block_device_mappings) or the
[launch_block_device_mappings](#launch_block_device_mappings) array.
<%= partial "partials/builder/amazon/common/BlockDevice" %>
@include 'partials/builder/amazon/common/BlockDevice.mdx'
#### Optional:
<%= partial "partials/builder/amazon/common/BlockDevice-not-required" %>
@include 'partials/builder/amazon/common/BlockDevice-not-required.mdx'
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/helper/communicator/SSH-not-required.mdx'
## Basic Example
@ -151,25 +154,25 @@ You can use this information to access the instance as it is running.
In configuration directives marked as a template engine above, the following
variables are available:
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
- `BuildRegion` - The region (for example `eu-central-1`) where Packer is
building the AMI.
- `SourceAMI` - The source AMI ID (for example `ami-a2412fcd`) used to build
the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIOwner` - The source AMI owner ID.
- `SourceAMIOwnerName` - The source AMI owner alias/name (for example `amazon`).
- `SourceAMITags` - The source AMI Tags, as a `map[string]string` object.
## Build function template engine variables
For the build function of [template engine](/docs/templates/engine.html), the following
variables are available:
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
- `SourceAMIName` - The source AMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the AMI.
## Custom Bundle Commands
@ -195,7 +198,7 @@ multiple lines for convenience of reading. The bundle volume command is
responsible for executing `ec2-bundle-vol` in order to store and image of the
root filesystem to use to create the AMI.
``` text
```text
sudo -i -n ec2-bundle-vol \
-k {{.KeyPath}} \
-u {{.AccountId}} \
@ -223,7 +226,7 @@ across multiple lines for convenience of reading. Access key and secret key are
omitted if using instance profile. The bundle upload command is responsible for
taking the bundled volume and uploading it to S3.
``` text
```text
sudo -i -n ec2-upload-bundle \
-b {{.BucketName}} \
-m {{.ManifestPath}} \
@ -248,24 +251,23 @@ this:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:PutObjectAcl"
],
"Resource": "*"
}
]
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:PutObjectAcl"
],
"Resource": "*"
}
]
}
```
You may wish to constrain the resource to a specific bucket.
<%= partial "partials/builders/aws-ssh-differentiation-table" %>
@include 'partials/builders/aws-ssh-differentiation-table.mdx'

View File

@ -1,10 +1,10 @@
---
description: |
Packer is able to create Amazon AMIs. To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the AMI.
Packer is able to create Amazon AMIs. To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the AMI.
layout: docs
page_title: 'Amazon AMI - Builders'
sidebar_current: 'docs-builders-amazon'
page_title: Amazon AMI - Builders
sidebar_current: docs-builders-amazon
---
# Amazon AMI Builder
@ -13,26 +13,26 @@ Packer is able to create Amazon AMIs. To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the AMI.
Packer supports the following builders at the moment:
- [amazon-ebs](/docs/builders/amazon-ebs.html) - Create EBS-backed AMIs by
launching a source AMI and re-packaging it into a new AMI after
provisioning. If in doubt, use this builder, which is the easiest to get
started with.
- [amazon-ebs](/docs/builders/amazon-ebs.html) - Create EBS-backed AMIs by
launching a source AMI and re-packaging it into a new AMI after
provisioning. If in doubt, use this builder, which is the easiest to get
started with.
- [amazon-instance](/docs/builders/amazon-instance.html) - Create
instance-store AMIs by launching and provisioning a source instance, then
rebundling it and uploading it to S3.
- [amazon-instance](/docs/builders/amazon-instance.html) - Create
instance-store AMIs by launching and provisioning a source instance, then
rebundling it and uploading it to S3.
- [amazon-chroot](/docs/builders/amazon-chroot.html) - Create EBS-backed AMIs
from an existing EC2 instance by mounting the root device and using a
[Chroot](https://en.wikipedia.org/wiki/Chroot) environment to provision
that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed AMI
since no new EC2 instance needs to be launched.
- [amazon-chroot](/docs/builders/amazon-chroot.html) - Create EBS-backed AMIs
from an existing EC2 instance by mounting the root device and using a
[Chroot](https://en.wikipedia.org/wiki/Chroot) environment to provision
that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed AMI
since no new EC2 instance needs to be launched.
- [amazon-ebssurrogate](/docs/builders/amazon-ebssurrogate.html) - Create EBS
-backed AMIs from scratch. Works similarly to the `chroot` builder but does
not require running in AWS. This is an **advanced builder and should not be
used by newcomers**.
- [amazon-ebssurrogate](/docs/builders/amazon-ebssurrogate.html) - Create EBS
-backed AMIs from scratch. Works similarly to the `chroot` builder but does
not require running in AWS. This is an **advanced builder and should not be
used by newcomers**.
-&gt; **Don't know which builder to use?** If in doubt, use the [amazon-ebs
builder](/docs/builders/amazon-ebs.html). It is much easier to use and Amazon
@ -43,9 +43,9 @@ generally recommends EBS-backed images nowadays.
Packer is able to create Amazon EBS Volumes which are preinitialized with a
filesystem and data.
- [amazon-ebsvolume](/docs/builders/amazon-ebsvolume.html) - Create EBS
volumes by launching a source AMI with block devices mapped. Provision the
instance, then destroy it, retaining the EBS volumes.
- [amazon-ebsvolume](/docs/builders/amazon-ebsvolume.html) - Create EBS
volumes by launching a source AMI with block devices mapped. Provision the
instance, then destroy it, retaining the EBS volumes.
<span id="specifying-amazon-credentials"></span>
@ -55,10 +55,10 @@ The AWS provider offers a flexible means of providing credentials for
authentication. The following methods are supported, in this order, and
explained below:
- Static credentials
- Environment variables
- Shared credentials file
- EC2 Role
- Static credentials
- Environment variables
- Shared credentials file
- EC2 Role
### Static Credentials
@ -67,10 +67,10 @@ These look like:
```json
{
"access_key": "AKIAIOSFODNN7EXAMPLE",
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"region": "us-east-1",
"type": "amazon-ebs"
"access_key": "AKIAIOSFODNN7EXAMPLE",
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"region": "us-east-1",
"type": "amazon-ebs"
}
```
@ -93,7 +93,7 @@ Usage:
### Shared Credentials file
You can use an AWS credentials file to specify your credentials. The default
location is $HOME/.aws/credentials on Linux and OS X, or
location is \$HOME/.aws/credentials on Linux and OS X, or
"%USERPROFILE%.aws\\credentials" for Windows users. If we fail to detect
credentials inline, or in the environment, Packer will check this location. You
can optionally specify a different location in the configuration by setting the
@ -110,9 +110,9 @@ configuration option, or setting the `AWS_PROFILE` environment variable:
```json
{
"profile": "customprofile",
"region": "us-east-1",
"type": "amazon-ebs"
"profile": "customprofile",
"region": "us-east-1",
"type": "amazon-ebs"
}
```
@ -131,9 +131,10 @@ for Packer to work:
```json
{
"Version": "2012-10-17",
"Statement": [{
"Statement": [
{
"Effect": "Allow",
"Action" : [
"Action": [
"ec2:AttachVolume",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CopyImage",
@ -168,8 +169,9 @@ for Packer to work:
"ec2:StopInstances",
"ec2:TerminateInstances"
],
"Resource" : "*"
}]
"Resource": "*"
}
]
}
```
@ -200,15 +202,10 @@ work, but specifics will depend on your use-case.
```json
{
"Sid": "PackerIAMPassRole",
"Effect": "Allow",
"Action": [
"iam:PassRole",
"iam:GetInstanceProfile"
],
"Resource": [
"*"
]
"Sid": "PackerIAMPassRole",
"Effect": "Allow",
"Action": ["iam:PassRole", "iam:GetInstanceProfile"],
"Resource": ["*"]
}
```
@ -217,22 +214,22 @@ IAM policies.
```json
{
"Sid": "PackerIAMCreateRole",
"Effect": "Allow",
"Action": [
"iam:PassRole",
"iam:CreateInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:GetRole",
"iam:GetInstanceProfile",
"iam:DeleteRolePolicy",
"iam:RemoveRoleFromInstanceProfile",
"iam:CreateRole",
"iam:DeleteRole",
"iam:PutRolePolicy",
"iam:AddRoleToInstanceProfile"
],
"Resource": "*"
"Sid": "PackerIAMCreateRole",
"Effect": "Allow",
"Action": [
"iam:PassRole",
"iam:CreateInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:GetRole",
"iam:GetInstanceProfile",
"iam:DeleteRolePolicy",
"iam:RemoveRoleFromInstanceProfile",
"iam:CreateRole",
"iam:DeleteRole",
"iam:PutRolePolicy",
"iam:AddRoleToInstanceProfile"
],
"Resource": "*"
}
```
@ -241,13 +238,10 @@ following policies at a minimum:
```json
{
"Sid": "Allow use of the key",
"Effect": "Allow",
"Action": [
"kms:ReEncrypt*",
"kms:GenerateDataKey*"
],
"Resource": "*"
"Sid": "Allow use of the key",
"Effect": "Allow",
"Action": ["kms:ReEncrypt*", "kms:GenerateDataKey*"],
"Resource": "*"
}
```
@ -255,11 +249,9 @@ If you are using a key provided by a different account than the one you are
using to run the Packer build, your key will also need
```json
"kms:CreateGrant",
"kms:DescribeKey"
("kms:CreateGrant", "kms:DescribeKey")
```
### Checking that system time is current
Amazon uses the current time as part of the [request signing
@ -275,38 +267,37 @@ Linux/OS X, you can run the `date` command to get the current time. If you're
on Linux, you can try setting the time with ntp by running `sudo ntpd -q`.
### ResourceNotReady Error
This error generally appears as either `ResourceNotReady: exceeded wait
attempts` or `ResourceNotReady: failed waiting for successful resource state`.
This error generally appears as either `ResourceNotReady: exceeded wait attempts` or `ResourceNotReady: failed waiting for successful resource state`.
This opaque error gets returned from AWS's API for a number of reasons,
generally during image copy/encryption. Possible reasons for the error include:
- You aren't waiting long enough. This is where you'll see the `exceeded wait
attempts` variety of this error message:
- You aren't waiting long enough. This is where you'll see the `exceeded wait attempts` variety of this error message:
We use the AWS SDK's built-in waiters to wait for longer-running tasks to
complete. These waiters have default delays between queries and maximum
number of queries that don't always work for our users.
complete. These waiters have default delays between queries and maximum
number of queries that don't always work for our users.
If you find that you are being rate-limited or have exceeded your max wait
attempts, you can override the defaults by setting the following packer
environment variables (note that these will apply to all AWS tasks that we
have to wait for):
If you find that you are being rate-limited or have exceeded your max wait
attempts, you can override the defaults by setting the following packer
environment variables (note that these will apply to all AWS tasks that we
have to wait for):
- `AWS_MAX_ATTEMPTS` - This is how many times to re-send a status update
- `AWS_MAX_ATTEMPTS` - This is how many times to re-send a status update
request. Excepting tasks that we know can take an extremely long time, this
defaults to 40 tries.
- `AWS_POLL_DELAY_SECONDS` - How many seconds to wait in between status update
- `AWS_POLL_DELAY_SECONDS` - How many seconds to wait in between status update
requests. Generally defaults to 2 or 5 seconds, depending on the task.
- You are using short-lived credentials that expired during the build. If this
is the problem, you may also see `RequestExpired: Request has expired.`
errors displayed in the Packer output:
is the problem, you may also see `RequestExpired: Request has expired.`
errors displayed in the Packer output:
- If you are using STS credentials, make sure that they expire only after the
- If you are using STS credentials, make sure that they expire only after the
build has completed
- If you are chaining roles, make sure your build doesn't last more than an
- If you are chaining roles, make sure your build doesn't last more than an
hour, since when you chain roles the maximum length of time your credentials
will last is an hour:
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html
@ -314,7 +305,7 @@ generally during image copy/encryption. Possible reasons for the error include:
- Something is wrong with your KMS key. This is where you'll see the
`ResourceNotReady: failed waiting for successful resource state` variety of
this error message. Issues we've seen include:
- Your KMS key is invalid, possibly because of a typo
- Your KMS key is valid but does not have the necessary permissions (see
above for the necessary key permissions)
- Your KMS key is valid, but not in the region you've told us to use it in.
- Your KMS key is invalid, possibly because of a typo
- Your KMS key is valid but does not have the necessary permissions (see
above for the necessary key permissions)
- Your KMS key is valid, but not in the region you've told us to use it in.

View File

@ -1,8 +1,8 @@
---
description: 'Packer supports building VHDs in Azure Resource manager.'
description: Packer supports building VHDs in Azure Resource manager.
layout: docs
page_title: 'Azure arm - Builders'
sidebar_current: 'docs-builders-azure-arm'
page_title: Azure arm - Builders
sidebar_current: docs-builders-azure-arm
---
# Azure Resource Manager Builder
@ -11,7 +11,7 @@ Type: `azure-arm`
Packer supports building VHDs and Managed Images in [Azure Resource
Manager](https://azure.microsoft.com/en-us/documentation/articles/resource-group-overview/).
Azure provides new users a [$200 credit for the first 30
Azure provides new users a [\$200 credit for the first 30
days](https://azure.microsoft.com/en-us/free/); after which you will incur
costs for VMs built and stored using Packer.
@ -26,43 +26,45 @@ CLI](https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/
There are many configuration options available for the builder. We'll start
with authentication parameters, then go over the Azure ARM builder specific
options. In addition to the options listed here, a [communicator](/docs/templates/communicator.html) can be configured for this builder.
options. In addition to the options listed here, a [communicator](/docs/templates/communicator.html) can be configured for this builder.
### Authentication options
<%= partial "partials/builder/azure/common/client/_Config" %>
@include 'partials/builder/azure/common/client/\_Config.mdx'
#### Managed Identity
If you're running packer on an Azure VM with a [managed identity](/docs/builders/azure.html#azure-managed-identity) you don't need to specify any additional configuration options. As Packer will attempt to use the Managed Identity and subscription of the VM that Packer is running on.
#### Interactive User Authentication
To use interactive user authentication, you should specify `subscription_id` only.
Packer will use cached credentials or redirect you to a website to log in.
#### Service Principal
To use a [service principal](/docs/builders/azure.html#azure-active-directory-service-principal)
you should specify `subscription_id`, `client_id` and one of `client_secret`,
`client_cert_path` or `client_jwt`.
- `subscription_id` (string) - Subscription under which the build will be
performed. **The service principal specified in `client_id` must have full
access to this subscription, unless build\_resource\_group\_name option is
specified in which case it needs to have owner access to the existing
resource group specified in build\_resource\_group\_name parameter.**
- `subscription_id` (string) - Subscription under which the build will be
performed. **The service principal specified in `client_id` must have full
access to this subscription, unless build_resource_group_name option is
specified in which case it needs to have owner access to the existing
resource group specified in build_resource_group_name parameter.**
- `client_id` (string) - The Active Directory service principal associated with
your builder.
- `client_id` (string) - The Active Directory service principal associated with
your builder.
- `client_secret` (string) - The password or secret for your service principal.
- `client_cert_path` (string) - The location of a PEM file containing a
certificate and private key for service principal.
- `client_jwt` (string) - The bearer JWT assertion signed using a certificate
associated with your service principal principal. See [Azure Active
Directory docs](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-certificate-credentials)
for more information.
- `client_secret` (string) - The password or secret for your service principal.
- `client_cert_path` (string) - The location of a PEM file containing a
certificate and private key for service principal.
- `client_jwt` (string) - The bearer JWT assertion signed using a certificate
associated with your service principal principal. See [Azure Active
Directory docs](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-certificate-credentials)
for more information.
### Azure ARM builder specific options
@ -72,39 +74,39 @@ a managed image you **must** start with a managed image.
### Required:
<%= partial "partials/builder/azure/arm/Config-required" %>
@include 'partials/builder/azure/arm/Config-required.mdx'
When creating a VHD the following additional options are required:
- `capture_container_name` (string) - Destination container name. Essentially
the "directory" where your VHD will be organized in Azure. The captured
VHD's URL will be
`https://<storage_account>.blob.core.windows.net/system/Microsoft.Compute/Images/<capture_container_name>/<capture_name_prefix>.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.vhd`.
- `capture_container_name` (string) - Destination container name. Essentially
the "directory" where your VHD will be organized in Azure. The captured
VHD's URL will be
`https://<storage_account>.blob.core.windows.net/system/Microsoft.Compute/Images/<capture_container_name>/<capture_name_prefix>.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.vhd`.
- `capture_name_prefix` (string) - VHD prefix. The final artifacts will be
named `PREFIX-osDisk.UUID` and `PREFIX-vmTemplate.UUID`.
- `capture_name_prefix` (string) - VHD prefix. The final artifacts will be
named `PREFIX-osDisk.UUID` and `PREFIX-vmTemplate.UUID`.
- `resource_group_name` (string) - Resource group under which the final
artifact will be stored.
- `resource_group_name` (string) - Resource group under which the final
artifact will be stored.
- `storage_account` (string) - Storage account under which the final artifact
will be stored.
- `storage_account` (string) - Storage account under which the final artifact
will be stored.
When creating a managed image the following additional options are required:
- `managed_image_name` (string) - Specify the managed image name where the
result of the Packer build will be saved. The image name must not exist
ahead of time, and will not be overwritten. If this value is set, the value
`managed_image_resource_group_name` must also be set. See
[documentation](https://docs.microsoft.com/en-us/azure/storage/storage-managed-disks-overview#images)
to learn more about managed images.
- `managed_image_name` (string) - Specify the managed image name where the
result of the Packer build will be saved. The image name must not exist
ahead of time, and will not be overwritten. If this value is set, the value
`managed_image_resource_group_name` must also be set. See
[documentation](https://docs.microsoft.com/en-us/azure/storage/storage-managed-disks-overview#images)
to learn more about managed images.
- `managed_image_resource_group_name` (string) - Specify the managed image
resource group name where the result of the Packer build will be saved. The
resource group must already exist. If this value is set, the value
`managed_image_name` must also be set. See
[documentation](https://docs.microsoft.com/en-us/azure/storage/storage-managed-disks-overview#images)
to learn more about managed images.
- `managed_image_resource_group_name` (string) - Specify the managed image
resource group name where the result of the Packer build will be saved. The
resource group must already exist. If this value is set, the value
`managed_image_name` must also be set. See
[documentation](https://docs.microsoft.com/en-us/azure/storage/storage-managed-disks-overview#images)
to learn more about managed images.
#### Shared Image Gallery
@ -141,29 +143,28 @@ artifacts.
To have packer create a resource group you **must** provide:
- `location` (string) Azure datacenter in which your VM will build.
- `location` (string) Azure datacenter in which your VM will build.
CLI example `az account list-locations`
CLI example `az account list-locations`
and optionally:
- `temp_resource_group_name` (string) name assigned to the temporary resource
group created during the build. If this value is not set, a random value
will be assigned. This resource group is deleted at the end of the build.
- `temp_resource_group_name` (string) name assigned to the temporary resource
group created during the build. If this value is not set, a random value
will be assigned. This resource group is deleted at the end of the build.
To use an existing resource group you **must** provide:
- `build_resource_group_name` (string) - Specify an existing resource group
to run the build in.
- `build_resource_group_name` (string) - Specify an existing resource group
to run the build in.
Providing `temp_resource_group_name` or `location` in combination with
`build_resource_group_name` is not allowed.
### Optional:
<%= partial "partials/builder/azure/arm/Config-not-required" %>
<%= partial "partials/builder/azure/common/client/_Config-not-required" %>
@include 'partials/builder/azure/arm/Config-not-required.mdx'
@include 'partials/builder/azure/common/client/\_Config-not-required.mdx'
## Basic Example
@ -171,29 +172,29 @@ Here is a basic example for Azure.
```json
{
"type": "azure-arm",
"type": "azure-arm",
"client_id": "fe354398-d7sf-4dc9-87fd-c432cd8a7e09",
"client_secret": "keepitsecret&#*$",
"resource_group_name": "packerdemo",
"storage_account": "virtualmachines",
"subscription_id": "44cae533-4247-4093-42cf-897ded6e7823",
"tenant_id": "de39842a-caba-497e-a798-7896aea43218",
"client_id": "fe354398-d7sf-4dc9-87fd-c432cd8a7e09",
"client_secret": "keepitsecret&#*$",
"resource_group_name": "packerdemo",
"storage_account": "virtualmachines",
"subscription_id": "44cae533-4247-4093-42cf-897ded6e7823",
"tenant_id": "de39842a-caba-497e-a798-7896aea43218",
"capture_container_name": "images",
"capture_name_prefix": "packer",
"capture_container_name": "images",
"capture_name_prefix": "packer",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "14.04.4-LTS",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "14.04.4-LTS",
"azure_tags": {
"dept": "engineering"
},
"azure_tags": {
"dept": "engineering"
},
"location": "West US",
"vm_size": "Standard_A2"
"location": "West US",
"vm_size": "Standard_A2"
}
```
@ -218,18 +219,18 @@ here](https://technet.microsoft.com/en-us/library/hh824815.aspx)
```json
{
"provisioners": [
"provisioners": [
{
"type": "powershell",
"inline": [
" # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
" while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
"type": "powershell",
"inline": [
" # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
" while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }"
]
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }"
]
}
]
}
@ -254,30 +255,30 @@ Deprovision should be the last operation executed by a build.
```json
{
"provisioners": [
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}
]
"provisioners": [
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}
]
}
```
To learn more about the Linux deprovision process please see WALinuxAgent's
[README](https://github.com/Azure/WALinuxAgent/blob/master/README.md).
#### skip\_clean
#### skip_clean
Customers have reported issues with the deprovision process where the builder
hangs. The error message is similar to the following.
Build 'azure-arm' errored: Retryable error: Error removing temporary script at /tmp/script_9899.sh: ssh: handshake failed: EOF
One solution is to set skip\_clean to true in the provisioner. This prevents
One solution is to set skip_clean to true in the provisioner. This prevents
Packer from cleaning up any helper scripts uploaded to the VM during the build.
## Defaults
@ -285,17 +286,17 @@ Packer from cleaning up any helper scripts uploaded to the VM during the build.
The Azure builder attempts to pick default values that provide for a just works
experience. These values can be changed by the user to more suitable values.
- The default user name is packer not root as in other builders. Most distros
on Azure do not allow root to SSH to a VM hence the need for a non-root
default user. Set the ssh\_username option to override the default value.
- The default VM size is Standard\_A1. Set the vm\_size option to override
the default value.
- The default image version is latest. Set the image\_version option to
override the default value.
- By default a temporary resource group will be created and destroyed as part
of the build. If you do not have permissions to do so, use
`build_resource_group_name` to specify an existing resource group to run
the build in.
- The default user name is packer not root as in other builders. Most distros
on Azure do not allow root to SSH to a VM hence the need for a non-root
default user. Set the ssh_username option to override the default value.
- The default VM size is Standard_A1. Set the vm_size option to override
the default value.
- The default image version is latest. Set the image_version option to
override the default value.
- By default a temporary resource group will be created and destroyed as part
of the build. If you do not have permissions to do so, use
`build_resource_group_name` to specify an existing resource group to run
the build in.
## Implementation
@ -338,27 +339,27 @@ templated with place holders for names, passwords, SSH keys, certificates, etc.
The Azure builder creates the following random values at runtime.
- Administrator Password: a random 32-character value using the *password
alphabet*.
- Certificate: a 2,048-bit certificate used to secure WinRM communication.
The certificate is valid for 24-hours, which starts roughly at invocation
time.
- Certificate Password: a random 32-character value using the *password
alphabet* used to protect the private key of the certificate.
- Compute Name: a random 15-character name prefixed with pkrvm; the name of
the VM.
- Deployment Name: a random 15-character name prefixed with pkfdp; the name
of the deployment.
- KeyVault Name: a random 15-character name prefixed with pkrkv.
- NIC Name: a random 15-character name prefixed with pkrni.
- Public IP Name: a random 15-character name prefixed with pkrip.
- OS Disk Name: a random 15-character name prefixed with pkros.
- Resource Group Name: a random 33-character name prefixed with
packer-Resource-Group-.
- Subnet Name: a random 15-character name prefixed with pkrsn.
- SSH Key Pair: a 2,048-bit asymmetric key pair; can be overridden by the
user.
- Virtual Network Name: a random 15-character name prefixed with pkrvn.
- Administrator Password: a random 32-character value using the _password
alphabet_.
- Certificate: a 2,048-bit certificate used to secure WinRM communication.
The certificate is valid for 24-hours, which starts roughly at invocation
time.
- Certificate Password: a random 32-character value using the _password
alphabet_ used to protect the private key of the certificate.
- Compute Name: a random 15-character name prefixed with pkrvm; the name of
the VM.
- Deployment Name: a random 15-character name prefixed with pkfdp; the name
of the deployment.
- KeyVault Name: a random 15-character name prefixed with pkrkv.
- NIC Name: a random 15-character name prefixed with pkrni.
- Public IP Name: a random 15-character name prefixed with pkrip.
- OS Disk Name: a random 15-character name prefixed with pkros.
- Resource Group Name: a random 33-character name prefixed with
packer-Resource-Group-.
- Subnet Name: a random 15-character name prefixed with pkrsn.
- SSH Key Pair: a 2,048-bit asymmetric key pair; can be overridden by the
user.
- Virtual Network Name: a random 15-character name prefixed with pkrvn.
The default alphabet used for random values is
**0123456789bcdfghjklmnpqrstvwxyz**. The alphabet was reduced (no vowels) to

View File

@ -1,10 +1,12 @@
---
description: |
The azure-chroot Packer builder is able to create Azure Managed Images leveraging
a VM in Azure.
description: >
The azure-chroot Packer builder is able to create Azure Managed Images
leveraging
a VM in Azure.
layout: docs
page_title: 'Azure chroot - Builders'
sidebar_current: 'docs-builders-azure-chroot'
page_title: Azure chroot - Builders
sidebar_current: docs-builders-azure-chroot
---
# Azure Builder (chroot)
@ -22,13 +24,13 @@ content and enables some capabilities that are not possible with the
`azure-arm` builder.
> **This is an advanced builder** If you're just getting started with Packer,
it is recommend to start with the [azure-arm builder](/docs/builders/azure-arm.html),
which is much easier to use.
> it is recommend to start with the [azure-arm builder](/docs/builders/azure-arm.html),
> which is much easier to use.
## How Does it Work?
This builder works by creating a new MD from either an existing source or from
scratch and attaching it to the (already existing) Azure VM where Packer is
scratch and attaching it to the (already existing) Azure VM where Packer is
running. Once attached, a [chroot](https://en.wikipedia.org/wiki/Chroot) is set
up and made available to the [provisioners](/docs/provisioners/index.html).
After provisioning, the MD is detached, snapshotted and a MD image is created.
@ -37,11 +39,12 @@ Using this process, minutes can be shaved off the image creation process
because Packer does not need to launch a VM instance.
There are some restrictions however:
* The host system must be a similar system (generally the same OS version,
- The host system must be a similar system (generally the same OS version,
kernel versions, etc.) as the image being built.
* If the source is a managed disk, it must be made available in the same
- If the source is a managed disk, it must be made available in the same
region as the host system.
* The host system SKU has to allow for all of the specified disks to be
- The host system SKU has to allow for all of the specified disks to be
attached.
## Configuration Reference
@ -51,20 +54,23 @@ with authentication parameters, then go over the Azure chroot builder specific
options.
### Authentication options
None of the authentication options are required, but depending on which
ones are specified a different authentication method may be used. See the
[shared Azure builders documentation](/docs/builders/azure.html) for more
information.
<%= partial "partials/builder/azure/common/client/_Config-not-required.html" %>
@include 'partials/builder/azure/common/client/\_Config-not-required.html.mdx'
### Azure chroot builder specific options
#### Required:
<%= partial "partials/builder/azure/chroot/_Config-required.html" %>
@include 'partials/builder/azure/chroot/\_Config-required.html.mdx'
#### Optional:
<%= partial "partials/builder/azure/chroot/_Config-not-required.html" %>
@include 'partials/builder/azure/chroot/\_Config-not-required.html.mdx'
## Chroot Mounts
@ -72,11 +78,11 @@ The `chroot_mounts` configuration can be used to mount specific devices within
the chroot. By default, the following additional mounts are added into the
chroot by Packer:
- `/proc` (proc)
- `/sys` (sysfs)
- `/dev` (bind to real `/dev`)
- `/dev/pts` (devpts)
- `/proc/sys/fs/binfmt_misc` (binfmt\_misc)
- `/proc` (proc)
- `/sys` (sysfs)
- `/dev` (bind to real `/dev`)
- `/dev/pts` (devpts)
- `/proc/sys/fs/binfmt_misc` (binfmt_misc)
These default mounts are usually good enough for anyone and are sane defaults.
However, if you want to change or add the mount points, you may using the
@ -95,31 +101,34 @@ mounts `/prod` and `/dev`:
`chroot_mounts` is a list of a 3-tuples of strings. The three components of the
3-tuple, in order, are:
- The filesystem type. If this is "bind", then Packer will properly bind the
filesystem to another mount point.
- The filesystem type. If this is "bind", then Packer will properly bind the
filesystem to another mount point.
- The source device.
- The source device.
- The mount directory.
- The mount directory.
## Additional template function
Because this builder runs on an Azure VM, there is an additional template function
available called `vm`, which returns the following VM metadata:
- name
- subscription_id
- resource_group
- location
- resource_id
- name
- subscription_id
- resource_group
- location
- resource_id
This function can be used in the configuration templates, for example, use
```
"{{ vm `subscription_id` }}"
```
to fill in the subscription ID of the VM in any of the configuration options.
## Examples
Here are some examples using this builder.
This builder requires privileged actions, such as mounting disks, running
`chroot` and other admin commands. Usually it needs to be run with root
@ -130,30 +139,33 @@ sudo -E packer build example.json
```
### Using a VM with a Managed Identity
On a VM with a system-assigned managed identity that has the contributor role
on its own resource group, the following config can be used to create an
updated Debian image:
```json
{
"builders": [{
"type": "azure-chroot",
"builders": [
{
"type": "azure-chroot",
"image_resource_id": "/subscriptions/{{vm `subscription_id`}}/resourceGroups/{{vm `resource_group`}}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}",
"source": "credativ:Debian:9:latest"
}],
"provisioners": [{
"inline": [
"apt-get update",
"apt-get upgrade -y"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}]
"image_resource_id": "/subscriptions/{{vm `subscription_id`}}/resourceGroups/{{vm `resource_group`}}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}",
"source": "credativ:Debian:9:latest"
}
],
"provisioners": [
{
"inline": ["apt-get update", "apt-get upgrade -y"],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}
]
}
```
### Using a Service Principal
Here is an example that creates a Debian image with updated packages. Specify
all environment variables (`ARM_CLIENT_ID`, `ARM_CLIENT_SECRET`,
`ARM_SUBSCRIPTION_ID`) to use a service principal.
@ -170,24 +182,25 @@ subscription where the resulting image will be created.
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
"resource_group": "{{env `ARM_IMAGE_RESOURCEGROUP_ID`}}"
},
"builders": [{
"type": "azure-chroot",
"builders": [
{
"type": "azure-chroot",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"subscription_id": "{{user `subscription_id`}}",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"subscription_id": "{{user `subscription_id`}}",
"image_resource_id": "/subscriptions/{{user `subscription_id`}}/resourceGroups/{{user `resource_group`}}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}",
"image_resource_id": "/subscriptions/{{user `subscription_id`}}/resourceGroups/{{user `resource_group`}}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}",
"source": "credativ:Debian:9:latest"
}],
"provisioners": [{
"inline": [
"apt-get update",
"apt-get upgrade -y"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}]
"source": "credativ:Debian:9:latest"
}
],
"provisioners": [
{
"inline": ["apt-get update", "apt-get upgrade -y"],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}
]
}
```
```

View File

@ -1,30 +1,32 @@
---
description: |
Packer is able to create Azure VM images. To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the images.
description: >
Packer is able to create Azure VM images. To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the
images.
layout: docs
page_title: 'Azure images - Builders'
sidebar_current: 'docs-builders-azure'
page_title: Azure images - Builders
sidebar_current: docs-builders-azure
---
# Azure Virtual Machine Image Builders
Packer can create Azure virtual machine images through variety of ways
depending on the strategy that you want to use for building the images.
Packer can create Azure virtual machine images through variety of ways
depending on the strategy that you want to use for building the images.
Packer supports the following builders for Azure images at the moment:
- [azure-arm](/docs/builders/azure-arm.html) - Uses Azure Resource
Manager (ARM) to launch a virtual machine (VM) from which a new image is
captured after provisioning. If in doubt, use this builder; it is the
easiest builder to get started with.
- [azure-arm](/docs/builders/azure-arm.html) - Uses Azure Resource
Manager (ARM) to launch a virtual machine (VM) from which a new image is
captured after provisioning. If in doubt, use this builder; it is the
easiest builder to get started with.
- [azure-chroot](/docs/builders/azure-chroot.html) - Uses ARM to create
a managed disk that is attached to an existing Azure VM that Packer is
running on. Provisioning leverages [Chroot](https://en.wikipedia.org/wiki/Chroot)
environment. After provisioning, the disk is detached an image is created
from this disk. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build a VM image in
Azure.
- [azure-chroot](/docs/builders/azure-chroot.html) - Uses ARM to create
a managed disk that is attached to an existing Azure VM that Packer is
running on. Provisioning leverages [Chroot](https://en.wikipedia.org/wiki/Chroot)
environment. After provisioning, the disk is detached an image is created
from this disk. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build a VM image in
Azure.
-&gt; **Don't know which builder to use?** If in doubt, use the [azure-arm
builder](/docs/builders/azure-arm.html). It is much easier to use.
@ -34,10 +36,10 @@ builder](/docs/builders/azure-arm.html). It is much easier to use.
The Packer Azure builders provide a couple of ways to authenticate to Azure. The
following methods are available and are explained below:
- Azure Active Directory interactive login. Interactive login is available
for the Public and US Gov clouds only.
- Azure Managed Identity
- Azure Active Directory Service Principal
- Azure Active Directory interactive login. Interactive login is available
for the Public and US Gov clouds only.
- Azure Managed Identity
- Azure Active Directory Service Principal
-&gt; **Don't know which authentication method to use?** Go with interactive
login to try out the builders. If you need packer to run automatically,
@ -75,27 +77,26 @@ To get started, try assigning the `Contributor` role at the subscription level t
your VM. Then, when you discover your exact scenario, scope the permissions
appropriately or isolate Packer builds in a separate subscription.
## Azure Active Directory Service Principal
## Azure Active Directory Service Principal
Azure Active Directory models service accounts as 'Service Principal' (SP)
objects. An SP represents an application accessing your Azure resources. It
is identified by a client ID (aka application ID) and can use a password or a
certificate to authenticate. To use a Service Principal, specify the
certificate to authenticate. To use a Service Principal, specify the
`subscription_id` and `client_id`, as well as either `client_secret`,
`client_cert_path` or `client_jwt`. Each of these last three represent a different
way to authenticate the SP to AAD:
- `client_secret` - allows the user to provide a password/secret registered
for the AAD SP.
- `client_cert_path` - allows usage of a certificate to be used to
authenticate as the specified AAD SP.
- `client_jwt` - For advanced scenario's where the used cannot provide Packer
the full certificate, they can provide a JWT bearer token for client auth
(RFC 7523, Sec. 2.2). These bearer tokens are created and signed using a
certificate registered in AAD and have a user-chosen expiry time, limiting
the validity of the token. This is also the underlying mechanism used to
authenticate when using `client_cert_path`.
- `client_secret` - allows the user to provide a password/secret registered
for the AAD SP.
- `client_cert_path` - allows usage of a certificate to be used to
authenticate as the specified AAD SP.
- `client_jwt` - For advanced scenario's where the used cannot provide Packer
the full certificate, they can provide a JWT bearer token for client auth
(RFC 7523, Sec. 2.2). These bearer tokens are created and signed using a
certificate registered in AAD and have a user-chosen expiry time, limiting
the validity of the token. This is also the underlying mechanism used to
authenticate when using `client_cert_path`.
To create a service principal, you can follow [the Azure documentation on this
subject](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest).

View File

@ -0,0 +1,235 @@
---
description: |
The cloudstack Packer builder is able to create new templates for use with
CloudStack. The builder takes either an ISO or an existing template as it's
source, runs any provisioning necessary on the instance after launching it and
then creates a new template from that instance.
layout: docs
page_title: CloudStack - Builders
sidebar_current: docs-builders-cloudstack
---
# CloudStack Builder
Type: `cloudstack`
The `cloudstack` Packer builder is able to create new templates for use with
[CloudStack](https://cloudstack.apache.org/). The builder takes either an ISO
or an existing template as it's source, runs any provisioning necessary on the
instance after launching it and then creates a new template from that instance.
The builder does _not_ manage templates. Once a template is created, it is up
to you to use it or delete it.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `api_url` (string) - The CloudStack API endpoint we will connect to. It can
also be specified via environment variable `CLOUDSTACK_API_URL`, if set.
- `api_key` (string) - The API key used to sign all API requests. It can also
be specified via environment variable `CLOUDSTACK_API_KEY`, if set.
- `network` (string) - The name or ID of the network to connect the instance
to.
- `secret_key` (string) - The secret key used to sign all API requests. It
can also be specified via environment variable `CLOUDSTACK_SECRET_KEY`, if
set.
- `service_offering` (string) - The name or ID of the service offering used
for the instance.
- `source_iso` (string) - The name or ID of an ISO that will be mounted
before booting the instance. This option is mutually exclusive with
`source_template`. When using `source_iso`, both `disk_offering` and
`hypervisor` are required.
- `source_template` (string) - The name or ID of the template used as base
template for the instance. This option is mutually exclusive with
`source_iso`.
- `template_os` (string) - The name or ID of the template OS for the new
template that will be created.
- `zone` (string) - The name or ID of the zone where the instance will be
created.
### Optional:
- `async_timeout` (number) - The time duration to wait for async calls to
finish. Defaults to 30m.
- `cidr_list` (array) - List of CIDR's that will have access to the new
instance. This is needed in order for any provisioners to be able to
connect to the instance. Defaults to `[ "0.0.0.0/0" ]`. Only required when
`use_local_ip_address` is `false`.
- `create_security_group` (boolean) - If `true` a temporary security group
will be created which allows traffic towards the instance from the
`cidr_list`. This option will be ignored if `security_groups` is also
defined. Requires `expunge` set to `true`. Defaults to `false`.
- `disk_offering` (string) - The name or ID of the disk offering used for the
instance. This option is only available (and also required) when using
`source_iso`.
- `disk_size` (number) - The size (in GB) of the root disk of the new
instance. This option is only available when using `source_template`.
- `expunge` (boolean) - Set to `true` to expunge the instance when it is
destroyed. Defaults to `false`.
- `http_directory` (string) - Path to a directory to serve using an HTTP
server. The files in this directory will be available over HTTP that will
be requestable from the virtual machine. This is useful for hosting
kickstart files and so on. By default this is "", which means no HTTP
server will be started. The address and port of the HTTP server will be
available as variables in `user_data`. This is covered in more detail
below.
- `http_get_only` (boolean) - Some cloud providers only allow HTTP GET calls
to their CloudStack API. If using such a provider, you need to set this to
`true` in order for the provider to only make GET calls and no POST calls.
- `http_port_min` and `http_port_max` (number) - These are the minimum and
maximum port to use for the HTTP server started to serve the
`http_directory`. Because Packer often runs in parallel, Packer will choose
a randomly available port in this range to run the HTTP server. If you want
to force the HTTP server to be on one port, make this minimum and maximum
port the same. By default the values are 8000 and 9000, respectively.
- `hypervisor` (string) - The target hypervisor (e.g. `XenServer`, `KVM`) for
the new template. This option is required when using `source_iso`.
- `eject_iso` (boolean) - If `true` make a call to the CloudStack API, after
loading image to cache, requesting to check and detach ISO file (if any)
currently attached to a virtual machine. Defaults to `false`. This option
is only available when using `source_iso`.
- `eject_iso_delay` (time.Duration) - Configure the duration time to wait, making
sure virtual machine is able to finish installing OS before it ejects safely.
Requires `eject_iso` set to `true` and this option is only available when
using `source_iso`.
- `keypair` (string) - The name of the SSH key pair that will be used to
access the instance. The SSH key pair is assumed to be already available
within CloudStack.
- `instance_name` (string) - The name of the instance. Defaults to
"packer-UUID" where UUID is dynamically generated.
- `prevent_firewall_changes` (boolean) - Set to `true` to prevent network
ACLs or firewall rules creation. Defaults to `false`.
- `project` (string) - The name or ID of the project to deploy the instance
to.
- `public_ip_address` (string) - The public IP address or it's ID used for
connecting any provisioners to. If not provided, a temporary public IP
address will be associated and released during the Packer run.
- `public_port` (number) - The fixed port you want to configure in the port
forwarding rule. Set this attribute if you do not want to use the a random
public port.
- `security_groups` (array of strings) - A list of security group IDs or
names to associate the instance with.
- `ssh_agent_auth` (boolean) - If true, the local SSH agent will be used to
authenticate connections to the source instance. No temporary keypair will
be created, and the values of `ssh_password` and `ssh_private_key_file`
will be ignored. To use this option with a key pair already configured in
the source image, leave the `keypair` blank. To associate an existing key
pair with the source instance, set the `keypair` field to the name of the
key pair.
- `ssl_no_verify` (boolean) - Set to `true` to skip SSL verification.
Defaults to `false`.
- `template_display_text` (string) - The display text of the new template.
Defaults to the `template_name`.
- `template_featured` (boolean) - Set to `true` to indicate that the template
is featured. Defaults to `false`.
- `template_name` (string) - The name of the new template. Defaults to
"packer-{{timestamp}}" where timestamp will be the current time.
- `template_public` (boolean) - Set to `true` to indicate that the template
is available for all accounts. Defaults to `false`.
- `template_password_enabled` (boolean) - Set to `true` to indicate the
template should be password enabled. Defaults to `false`.
- `template_requires_hvm` (boolean) - Set to `true` to indicate the template
requires hardware-assisted virtualization. Defaults to `false`.
- `template_scalable` (boolean) - Set to `true` to indicate that the template
contains tools to support dynamic scaling of VM cpu/memory. Defaults to
`false`.
- `temporary_keypair_name` (string) - The name of the temporary SSH key pair
to generate. By default, Packer generates a name that looks like
`packer_<UUID>`, where &lt;UUID&gt; is a 36 character unique identifier.
- `user_data` (string) - User data to launch with the instance. This is a
[template engine](/docs/templates/engine.html) see _User Data_ bellow for
more details. Packer will not automatically wait for a user script to
finish before shutting down the instance this must be handled in a
provisioner.
- `user_data_file` (string) - Path to a file that will be used for the user
data when launching the instance. This file will be parsed as a [template
engine](/docs/templates/engine.html) see _User Data_ bellow for more
details.
- `use_local_ip_address` (boolean) - Set to `true` to indicate that the
provisioners should connect to the local IP address of the instance.
## User Data
The available variables are:
- `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server
that is started serving the directory specified by the `http_directory`
configuration parameter. If `http_directory` isn't specified, these will be
blank. Example: `{{.HTTPIP}}:{{.HTTPPort}}/path/to/a/file/in/http_directory`
## Basic Example
Here is a basic example.
```json
{
"type": "cloudstack",
"api_url": "https://cloudstack.company.com/client/api",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"disk_offering": "Small - 20GB",
"hypervisor": "KVM",
"network": "management",
"service_offering": "small",
"source_iso": "CentOS-7.0-1406-x86_64-Minimal",
"zone": "NL1",
"ssh_username": "root",
"template_name": "Centos7-x86_64-KVM-Packer",
"template_display_text": "Centos7-x86_64 KVM Packer",
"template_featured": true,
"template_password_enabled": true,
"template_scalable": true,
"template_os": "Other PV (64-bit)"
}
```

View File

@ -1,10 +1,10 @@
---
description: |
Community-maintained builders are not part of the core Packer binary, but
can run alongside Packer with minimal extra effort.
Community-maintained builders are not part of the core Packer binary, but
can run alongside Packer with minimal extra effort.
layout: docs
page_title: 'Community - Builders'
sidebar_current: 'docs-builders-community'
page_title: Community - Builders
sidebar_current: docs-builders-community
---
# Community Builders
@ -13,4 +13,4 @@ The following builders are developed and maintained by various members of the
Packer community, not by HashiCorp. For more information on how to use community
builders, see our docs on [extending Packer](/docs/extending/index.html).
<%= partial "partials/builders/community_builders" %>
@include 'partials/builders/community_builders.mdx'

View File

@ -1,11 +1,11 @@
---
description: |
Packer is extensible, allowing you to write new builders without having to
modify the core source code of Packer itself. Documentation for creating new
builders is covered in the custom builders page of the Packer plugin section.
Packer is extensible, allowing you to write new builders without having to
modify the core source code of Packer itself. Documentation for creating new
builders is covered in the custom builders page of the Packer plugin section.
layout: docs
page_title: 'Custom - Builders'
sidebar_current: 'docs-builders-custom'
page_title: Custom - Builders
sidebar_current: docs-builders-custom
---
# Custom Builder

View File

@ -0,0 +1,135 @@
---
description: >
The digitalocean Packer builder is able to create new images for use with
DigitalOcean. The builder takes a source image, runs any provisioning
necessary
on the image after launching it, then snapshots it into a reusable image. This
reusable image can then be used as the foundation of new servers that are
launched within DigitalOcean.
layout: docs
page_title: DigitalOcean - Builders
sidebar_current: docs-builders-digitalocean
---
# DigitalOcean Builder
Type: `digitalocean`
The `digitalocean` Packer builder is able to create new images for use with
[DigitalOcean](https://www.digitalocean.com). The builder takes a source image,
runs any provisioning necessary on the image after launching it, then snapshots
it into a reusable image. This reusable image can then be used as the
foundation of new servers that are launched within DigitalOcean.
The builder does _not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `api_token` (string) - The client TOKEN to use to access your account. It
can also be specified via environment variable `DIGITALOCEAN_API_TOKEN`, if
set.
- `image` (string) - The name (or slug) of the base image to use. This is the
image that will be used to launch a new droplet and provision it. See
<a
href="https://developers.digitalocean.com/documentation/v2/#list-all-images"
class="uri"
>
https://developers.digitalocean.com/documentation/v2/#list-all-images
</a>
for details on how to get a list of the accepted image names/slugs.
- `region` (string) - The name (or slug) of the region to launch the droplet
in. Consequently, this is the region where the snapshot will be available.
See
<a
href="https://developers.digitalocean.com/documentation/v2/#list-all-regions"
class="uri"
>
https://developers.digitalocean.com/documentation/v2/#list-all-regions
</a>
for the accepted region names/slugs.
- `size` (string) - The name (or slug) of the droplet size to use. See
<a
href="https://developers.digitalocean.com/documentation/v2/#list-all-sizes"
class="uri"
>
https://developers.digitalocean.com/documentation/v2/#list-all-sizes
</a>
for the accepted size names/slugs.
### Optional:
- `api_url` (string) - Non standard api endpoint URL. Set this if you are
using a DigitalOcean API compatible service. It can also be specified via
environment variable `DIGITALOCEAN_API_URL`.
- `droplet_name` (string) - The name assigned to the droplet. DigitalOcean
sets the hostname of the machine to this value.
- `private_networking` (boolean) - Set to `true` to enable private networking
for the droplet being created. This defaults to `false`, or not enabled.
- `monitoring` (boolean) - Set to `true` to enable monitoring for the droplet
being created. This defaults to `false`, or not enabled.
- `ipv6` (boolean) - Set to `true` to enable ipv6 for the droplet being
created. This defaults to `false`, or not enabled.
- `snapshot_name` (string) - The name of the resulting snapshot that will
appear in your account. Defaults to "packer-{{timestamp}}" (see
[configuration templates](/docs/templates/engine.html) for more info).
- `snapshot_regions` (array of strings) - The regions of the resulting
snapshot that will appear in your account.
- `state_timeout` (string) - The time to wait, as a duration string, for a
droplet to enter a desired state (such as "active") before timing out. The
default state timeout is "6m".
- `snapshot_timeout` (string) - The time to wait, as a duration string, for a
snapshot action to complete (e.g snapshot creation) before timing out. The
default snapshot timeout is "60m".
- `user_data` (string) - User data to launch with the Droplet. Packer will
not automatically wait for a user script to finish before shutting down the
instance this must be handled in a provisioner.
- `user_data_file` (string) - Path to a file that will be used for the user
data when launching the Droplet.
- `tags` (list) - Tags to apply to the droplet when it is created
## Basic Example
Here is a basic example. It is completely valid as soon as you enter your own
access tokens:
```json
{
"type": "digitalocean",
"api_token": "YOUR API KEY",
"image": "ubuntu-16-04-x64",
"region": "nyc3",
"size": "512mb",
"ssh_username": "root"
}
```

View File

@ -1,11 +1,14 @@
---
description: |
The docker Packer builder builds Docker images using Docker. The builder starts
a Docker container, runs provisioners within this container, then exports the
container for reuse or commits the image.
description: >
The docker Packer builder builds Docker images using Docker. The builder
starts
a Docker container, runs provisioners within this container, then exports the
container for reuse or commits the image.
layout: docs
page_title: 'Docker - Builders'
sidebar_current: 'docs-builders-docker'
page_title: Docker - Builders
sidebar_current: docs-builders-docker
---
# Docker Builder
@ -16,7 +19,7 @@ The `docker` Packer builder builds [Docker](https://www.docker.io) images using
Docker. The builder starts a Docker container, runs provisioners within this
container, then exports the container for reuse or commits the image.
Packer builds Docker containers *without* the use of
Packer builds Docker containers _without_ the use of
[Dockerfiles](https://docs.docker.com/engine/reference/builder/). By not using
`Dockerfiles`, Packer is able to provision containers with portable scripts or
configuration management systems that are not tied to Docker in any way. It
@ -25,8 +28,8 @@ provision a normal virtualized or dedicated server. For more information, read
the section on [Dockerfiles](#dockerfiles).
The Docker builder must run on a machine that has Docker Engine installed.
Therefore the builder only works on machines that support Docker and *does not
support running on a Docker remote host*. You can learn about what [platforms
Therefore the builder only works on machines that support Docker and _does not
support running on a Docker remote host_. You can learn about what [platforms
Docker supports and how to install onto
them](https://docs.docker.com/engine/installation/) in the Docker
documentation.
@ -92,39 +95,39 @@ from ubuntu as an simple example:
Allowed metadata fields that can be changed are:
- CMD
- String, supports both array (escaped) and string form
- EX: `"CMD [\"nginx\", \"-g\", \"daemon off;\"]"` corresponds to Docker exec form
- EX: `"CMD nginx -g daemon off;"` corresponds to Docker shell form, invokes a command shell first
- ENTRYPOINT
- String, supports both array (escaped) and string form
- EX: `"ENTRYPOINT [\"/bin/sh\", \"-c\", \"/var/www/start.sh\"]"` corresponds to Docker exec form
- EX: `"ENTRYPOINT /var/www/start.sh"` corresponds to Docker shell form, invokes a command shell first
- ENV
- String, note there is no equal sign:
- EX: `"ENV HOSTNAME www.example.com"` not
`"ENV HOSTNAME=www.example.com"`
- EXPOSE
- String, space separated ports
- EX: `"EXPOSE 80 443"`
- LABEL
- String, space separated key=value pairs
- EX: `"LABEL version=1.0"`
- ONBUILD
- String
- EX: `"ONBUILD RUN date"`
- MAINTAINER
- String, deprecated in Docker version 1.13.0
- EX: `"MAINTAINER NAME"`
- USER
- String
- EX: `"USER USERNAME"`
- VOLUME
- String
- EX: `"VOLUME FROM TO"`
- WORKDIR
- String
- EX: `"WORKDIR PATH"`
- CMD
- String, supports both array (escaped) and string form
- EX: `"CMD [\"nginx\", \"-g\", \"daemon off;\"]"` corresponds to Docker exec form
- EX: `"CMD nginx -g daemon off;"` corresponds to Docker shell form, invokes a command shell first
- ENTRYPOINT
- String, supports both array (escaped) and string form
- EX: `"ENTRYPOINT [\"/bin/sh\", \"-c\", \"/var/www/start.sh\"]"` corresponds to Docker exec form
- EX: `"ENTRYPOINT /var/www/start.sh"` corresponds to Docker shell form, invokes a command shell first
- ENV
- String, note there is no equal sign:
- EX: `"ENV HOSTNAME www.example.com"` not
`"ENV HOSTNAME=www.example.com"`
- EXPOSE
- String, space separated ports
- EX: `"EXPOSE 80 443"`
- LABEL
- String, space separated key=value pairs
- EX: `"LABEL version=1.0"`
- ONBUILD
- String
- EX: `"ONBUILD RUN date"`
- MAINTAINER
- String, deprecated in Docker version 1.13.0
- EX: `"MAINTAINER NAME"`
- USER
- String
- EX: `"USER USERNAME"`
- VOLUME
- String
- EX: `"VOLUME FROM TO"`
- WORKDIR
- String
- EX: `"WORKDIR PATH"`
## Configuration Reference
@ -132,20 +135,19 @@ Configuration options are organized below into two categories: required and
optional. Within each category, the available options are alphabetized and
described.
The Docker builder uses a special Docker communicator *and will not use* the
The Docker builder uses a special Docker communicator _and will not use_ the
standard [communicators](/docs/templates/communicator.html).
### Required:
You must specify (only) one of `commit`, `discard`, or `export_path`.
<%= partial "partials/builder/docker/Config-required" %>
@include 'partials/builder/docker/Config-required.mdx'
### Optional:
<%= partial "partials/builder/docker/AwsAccessConfig-not-required" %>
<%= partial "partials/builder/docker/Config-not-required" %>
@include 'partials/builder/docker/AwsAccessConfig-not-required.mdx'
@include 'partials/builder/docker/Config-not-required.mdx'
## Using the Artifact: Export
@ -155,7 +157,7 @@ with the [docker-import](/docs/post-processors/docker-import.html) and
[docker-push](/docs/post-processors/docker-push.html) post-processors.
**Note:** This section is covering how to use an artifact that has been
*exported*. More specifically, if you set `export_path` in your configuration.
_exported_. More specifically, if you set `export_path` in your configuration.
If you set `commit`, see the next section.
The example below shows a full configuration that would import and push the
@ -187,7 +189,7 @@ handles pushing the image to a container repository.
If you want to do this manually, however, perhaps from a script, you can import
the image using the process below:
``` shell
```shell
$ docker import - registry.mydomain.com/mycontainer:latest < artifact.tar
```
@ -261,7 +263,7 @@ containers. Windows containers use a different communicator than linux
containers, because Windows containers cannot use `docker cp`.
If you are building a Windows container, you must set the template option
`"windows_container": true`. Please note that docker cannot export Windows
`"windows_container": true`. Please note that docker cannot export Windows
containers, so you must either commit or discard them.
The following is a fully functional template for building a Windows
@ -269,7 +271,7 @@ container.
```json
{
"builders": [
"builders": [
{
"type": "docker",
"image": "microsoft/windowsservercore:1709",
@ -313,7 +315,7 @@ credentials.](/docs/builders/amazon.html#specifying-amazon-credentials)
## Dockerfiles
This builder allows you to build Docker images *without* Dockerfiles.
This builder allows you to build Docker images _without_ Dockerfiles.
With this builder, you can repeatedly create Docker images without the use of a
Dockerfile. You don't need to know the syntax or semantics of Dockerfiles.

View File

@ -1,11 +1,11 @@
---
description: |
The file Packer builder is not really a builder, it just creates an artifact
from a file. It can be used to debug post-processors without incurring high
wait times.
The file Packer builder is not really a builder, it just creates an artifact
from a file. It can be used to debug post-processors without incurring high
wait times.
layout: docs
page_title: 'File - Builders'
sidebar_current: 'docs-builders-file'
page_title: File - Builders
sidebar_current: docs-builders-file
---
# File Builder
@ -39,15 +39,15 @@ Any [communicator](/docs/templates/communicator.html) defined is ignored.
### Required:
- `target` (string) - The path for a file which will be copied as the
artifact.
- `target` (string) - The path for a file which will be copied as the
artifact.
### Optional:
You can only define one of `source` or `content`. If none of them is defined
the artifact will be empty.
- `source` (string) - The path for a file which will be copied as the
artifact.
- `source` (string) - The path for a file which will be copied as the
artifact.
- `content` (string) - The content that will be put into the artifact.
- `content` (string) - The content that will be put into the artifact.

View File

@ -1,10 +1,10 @@
---
description: |
The googlecompute Packer builder is able to create images for use with Google
Cloud Compute Engine (GCE) based on existing images.
The googlecompute Packer builder is able to create images for use with Google
Cloud Compute Engine (GCE) based on existing images.
layout: docs
page_title: 'Google Compute - Builders'
sidebar_current: 'docs-builders-googlecompute'
page_title: Google Compute - Builders
sidebar_current: docs-builders-googlecompute
---
# Google Compute Builder
@ -26,7 +26,7 @@ information.
## Authentication
Authenticating with Google Cloud services requires at most one JSON file,
called the *account file*. The *account file* is **not** required if you are
called the _account file_. The _account file_ is **not** required if you are
running the `googlecompute` Packer builder from a GCE instance with a
properly-configured [Compute Engine Service
Account](https://cloud.google.com/compute/docs/authentication).
@ -44,7 +44,7 @@ scopes when launching the instance.
For `gcloud`, do this via the `--scopes` parameter:
``` shell
```shell
$ gcloud compute instances create INSTANCE-NAME \
--project YOUR_GCP_PROJECT \
--image-family ubuntu-1804-lts \
@ -62,7 +62,7 @@ For the [Google Developers Console](https://console.developers.google.com):
4. Choose "Full" for "Storage"
**The service account will be used automatically by Packer as long as there is
no *account file* specified in the Packer configuration file.**
no _account file_ specified in the Packer configuration file.**
### Running Without a Compute Engine Service Account
@ -82,7 +82,7 @@ straightforwarded, it is documented here.
`Compute Engine Instance Admin (v1)` and `Service Account User` roles.
5. Choose `JSON` as the Key type and click "Create". A JSON file will be
downloaded automatically. This is your *account file*.
downloaded automatically. This is your _account file_.
### Precedence of Authentication Methods
@ -115,7 +115,7 @@ location found:
Below is a fully functioning example. It doesn't do anything useful since no
provisioners or startup-script metadata are defined, but it will effectively
repackage an existing GCE image. The account\_file is obtained in the previous
repackage an existing GCE image. The account_file is obtained in the previous
section. If it parses as JSON it is assumed to be the file itself, otherwise,
it is assumed to be the path to the file containing the JSON.
@ -143,7 +143,13 @@ using the gcloud command.
gcloud compute firewall-rules create allow-winrm --allow tcp:5986
Or alternatively by navigating to
<a href="https://console.cloud.google.com/networking/firewalls/list" class="uri">https://console.cloud.google.com/networking/firewalls/list</a>.
<a
href="https://console.cloud.google.com/networking/firewalls/list"
class="uri"
>
https://console.cloud.google.com/networking/firewalls/list
</a>.
Once this is set up, the following is a complete working packer config after
setting a valid `account_file` and `project_id`:
@ -212,11 +218,11 @@ builder.
### Required:
<%= partial "partials/builder/googlecompute/Config-required" %>
@include 'partials/builder/googlecompute/Config-required.mdx'
### Optional:
<%= partial "partials/builder/googlecompute/Config-not-required" %>
@include 'partials/builder/googlecompute/Config-not-required.mdx'
## Startup Scripts
@ -236,7 +242,7 @@ be robust, as an image will still be built even when a startup script fails.
A Windows startup script can only be provided via the
`windows-startup-script-cmd` instance creation `metadata` field. The builder
will *not* wait for a Windows startup script to terminate. You have to ensure
will _not_ wait for a Windows startup script to terminate. You have to ensure
that it finishes before the instance shuts down.
### Logging

View File

@ -0,0 +1,129 @@
---
description: |
The Hetzner Cloud Packer builder is able to create new images for use with the
Hetzner Cloud. The builder takes a source image, runs any provisioning
necessary on the image after launching it, then snapshots it into a reusable
image. This reusable image can then be used as the foundation of new servers
that are launched within the Hetzner Cloud.
layout: docs
page_title: Hetzner Cloud - Builders
sidebar_current: docs-builders-hetzner-cloud
---
# Hetzner Cloud Builder
Type: `hcloud`
The `hcloud` Packer builder is able to create new images for use with [Hetzner
Cloud](https://www.hetzner.cloud). The builder takes a source image, runs any
provisioning necessary on the image after launching it, then snapshots it into
a reusable image. This reusable image can then be used as the foundation of new
servers that are launched within the Hetzner Cloud.
The builder does _not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `token` (string) - The client TOKEN to use to access your account. It can
also be specified via environment variable `HCLOUD_TOKEN`, if set.
- `image` (string) - ID or name of image to launch server from. Alternatively
you can use `image_filter`.
- `location` (string) - The name of the location to launch the server in.
- `server_type` (string) - ID or name of the server type this server should
be created with.
### Optional:
- `endpoint` (string) - Non standard api endpoint URL. Set this if you are
using a Hetzner Cloud API compatible service. It can also be specified via
environment variable `HCLOUD_ENDPOINT`.
- `image_filter` (object) - Filters used to populate the `filter`
field. Example:
```json
{
"image_filter": {
"with_selector": [
"name==my-image"
],
"most_recent": true
}
```
This selects the most recent image with the label `name==my-image`. NOTE:
This will fail unless _exactly_ one AMI is returned. In the above example,
`most_recent` will cause this to succeed by selecting the newest image.
- `with_selector` (list of strings) - label selectors used to select an
`image`. NOTE: This will fail unless _exactly_ one image is returned.
Check the official hcloud docs on
[Label Selectors](https://docs.hetzner.cloud/#overview-label-selector)
for more info.
- `most_recent` (boolean) - Selects the newest created image when true.
This is most useful if you base your image on another packer build image.
You may set this in place of `image`, but not both.
- `server_name` (string) - The name assigned to the server. The Hetzner Cloud
sets the hostname of the machine to this value.
- `snapshot_name` (string) - The name of the resulting snapshot that will
appear in your account. Defaults to "packer-{{timestamp}}" (see
[configuration templates](/docs/templates/engine.html) for more info).
- `snapshot_labels` (map of key/value strings) - Key/value pair labels to
apply to the created image.
- `poll_interval` (string) - Configures the interval in which actions are
polled by the client. Default `500ms`. Increase this interval if you run
into rate limiting errors.
- `user_data` (string) - User data to launch with the server. Packer will not
automatically wait for a user script to finish before shutting down the
instance this must be handled in a provisioner.
- `user_data_file` (string) - Path to a file that will be used for the user
data when launching the server.
- `ssh_keys` (array of strings) - List of SSH keys by name or id to be added
to image on launch.
- `rescue` (string) - Enable and boot in to the specified rescue system. This
enables simple installation of custom operating systems. `linux64`
`linux32` or `freebsd64`
## Basic Example
Here is a basic example. It is completely valid as soon as you enter your own
access tokens:
```json
{
"builders": [
{
"type": "hcloud",
"token": "YOUR API KEY",
"image": "ubuntu-18.04",
"location": "nbg1",
"server_type": "cx11",
"ssh_username": "root"
}
]
}
```

View File

@ -0,0 +1,245 @@
---
description: |
HyperOne Packer builder creates new images on the HyperOne platform.
The builder takes a source image, runs any provisioning necessary on
the image after launching it, then creates a reusable image.
layout: docs
page_title: HyperOne - Builders
sidebar_current: docs-builders-hyperone
---
# HyperOne Builder
Type: `hyperone`
The `hyperone` Packer builder is able to create new images on the [HyperOne
platform](http://www.hyperone.com/). The builder takes a source image, runs
any provisioning necessary on the image after launching it, then creates a
reusable image.
The builder does _not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
## Authentication
HyperOne supports several authentication methods, which are all supported by
this builder.
### User session
If using user session, set the `token` field to your authentication token.
The `project` field is required when using this method.
```json
{
"token": "YOUR TOKEN",
"project": "YOUR_PROJECT"
}
```
### User session by SSH key
If you've added an SSH key as a credential to your user account and the
private key is added to the ssh-agent on your local machine, you can
authenticate by setting just the platform login (your e-mail address):
```json
{
"token_login": "your.user@example.com"
}
```
### h1 CLI
If you're using [h1-cli](https://github.com/hyperonecom/h1-cli) on your local
machine, HyperOne builder can use your credentials saved in a config file.
All you have to do is login within the tool:
```bash
h1 login --username your.user@example.com
```
You don't have to set `token` or `project` fields at all using this method.
### Service account
Using `h1`, you can create a new token associated with chosen project.
```bash
h1 project token add --name packer-builder --project PROJECT_ID
```
Set the `token` field to the generated token or save it in the `HYPERONE_TOKEN`
environment variable. You don't have to set the `project` option using this
method.
```json
{
"token": "YOUR TOKEN"
}
```
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `disk_size` (float) - Size of the created disk, in GiB.
- `project` (string) - The id or name of the project. This field is required
only if using session tokens. It should be skipped when using service
account authentication.
- `source_image` (string) - ID or name of the image to launch server from.
- `token` (string) - The authentication token used to access your account.
This can be either a session token or a service account token.
If not defined, the builder will attempt to find it in the following order:
- In `HYPERONE_TOKEN` environment variable.
- In `~/.h1-cli/conf.json` config file used by [h1-cli](https://github.com/hyperonecom/h1-cli).
- By using SSH authentication if `token_login` variable has been set.
- `vm_type` (string) - ID or name of the type this server should be created with.
### Optional:
- `api_url` (string) - Custom API endpoint URL, compatible with HyperOne.
It can also be specified via environment variable `HYPERONE_API_URL`.
- `disk_name` (string) - The name of the created disk.
- `disk_type` (string) - The type of the created disk. Defaults to `ssd`.
- `image_description` (string) - The description of the resulting image.
- `image_name` (string) - The name of the resulting image. Defaults to
"packer-{{timestamp}}"
(see [configuration templates](/docs/templates/engine.html) for more info).
- `image_service` (string) - The service of the resulting image.
- `image_tags` (map of key/value strings) - Key/value pair tags to
add to the created image.
- `network` (string) - The ID of the network to attach to the created server.
- `private_ip` (string) - The ID of the private IP within chosen `network`
that should be assigned to the created server.
- `public_ip` (string) - The ID of the public IP that should be assigned to
the created server. If `network` is chosen, the public IP will be associated
with server's private IP.
- `public_netadp_service` (string) - Custom service of public network adapter.
Can be useful when using custom `api_url`. Defaults to `public`.
- `ssh_keys` (array of strings) - List of SSH keys by name or id to be added
to the server on launch.
- `state_timeout` (string) - Timeout for waiting on the API to complete
a request. Defaults to 5m.
- `token_login` (string) - Login (an e-mail) on HyperOne platform. Set this
if you want to fetch the token by SSH authentication.
- `user_data` (string) - User data to launch with the server. Packer will not
automatically wait for a user script to finish before shutting down the
instance, this must be handled in a provisioner.
- `vm_name` (string) - The name of the created server.
- `vm_tags` (map of key/value strings) - Key/value pair tags to
add to the created server.
## Chroot disk
### Required:
- `chroot_disk` (bool) - Set to `true` to enable chroot disk build.
- `pre_mount_commands` (array of strings) - A series of commands to execute
before mounting the chroot. This should include any partitioning and
filesystem creation commands. The path to the device is provided by
`{{.Device}}`.
### Optional:
- `chroot_command_wrapper` (string) - How to run shell commands. This defaults
to `{{.Command}}`. This may be useful to set if you want to set
environment variables or run commands with `sudo`.
- `chroot_copy_files` (array of strings) - Paths to files on the running VM
that will be copied into the chroot environment before provisioning.
Defaults to `/etc/resolv.conf` so that DNS lookups work.
- `chroot_disk_size` (float) - The size of the chroot disk in GiB. Defaults
to `disk_size`.
- `chroot_disk_type` (string) - The type of the chroot disk. Defaults to
`disk_type`.
- `chroot_mount_path` (string) - The path on which the device will be mounted.
- `chroot_mounts` (array of strings) - A list of devices to mount into the
chroot environment. This is a list of 3-element tuples, in order:
- The filesystem type. If this is "bind", then Packer will properly bind the
filesystem to another mount point.
- The source device.
- The mount directory.
- `mount_options` (array of tuples) - Options to supply the `mount` command
when mounting devices. Each option will be prefixed with `-o` and supplied
to the `mount` command.
- `mount_partition` (string) - The partition number containing the / partition.
By default this is the first partition of the volume (for example, sdb1).
- `post_mount_commands` (array of strings) - As `pre_mount_commands`, but the
commands are executed after mounting the root device and before the extra
mount and copy steps. The device and mount path are provided by
`{{.Device}}` and `{{.MountPath}}`.
## Basic Example
Here is a basic example. It is completely valid as soon as you enter your own
token.
```json
{
"type": "hyperone",
"token": "YOUR_AUTH_TOKEN",
"source_image": "ubuntu-18.04",
"vm_type": "a1.nano",
"disk_size": 10
}
```
## Chroot Example
```json
{
"type": "hyperone",
"token": "YOUR_AUTH_TOKEN",
"source_image": "ubuntu-18.04",
"vm_type": "a1.nano",
"disk_size": 10,
"chroot_disk": true,
"pre_mount_commands": [
"apt-get update",
"apt-get install debootstrap",
"debootstrap --arch amd64 bionic {{.MountPath}}"
]
}
```

View File

@ -2,11 +2,11 @@
modeline: |
vim: set ft=pandoc:
description: |
The Hyper-V Packer builder is able to create Hyper-V virtual machines and
export them.
The Hyper-V Packer builder is able to create Hyper-V virtual machines and
export them.
layout: docs
page_title: 'Hyper-V ISO - Builders'
sidebar_current: 'docs-builders-hyperv-iso'
page_title: Hyper-V ISO - Builders
sidebar_current: docs-builders-hyperv-iso
---
# Hyper-V Builder (from an ISO)
@ -50,15 +50,15 @@ power off the VM.
## ISO Configuration Reference
<%= partial "partials/common/ISOConfig" %>
@include 'partials/common/ISOConfig.mdx'
### Required:
<%= partial "partials/common/ISOConfig-required" %>
@include 'partials/common/ISOConfig-required.mdx'
### Optional:
<%= partial "partials/common/ISOConfig-not-required" %>
@include 'partials/common/ISOConfig-not-required.mdx'
## Configuration Reference
@ -72,44 +72,46 @@ builder.
### Optional:
- `output_directory` (string) - This setting specifies the directory that
artifacts from the build, such as the virtual machine files and disks,
will be output to. The path to the directory may be relative or
absolute. If relative, the path is relative to the working directory
`packer` is executed from. This directory must not exist or, if
created, must be empty prior to running the builder. By default this is
"output-BUILDNAME" where "BUILDNAME" is the name of the build.
- `output_directory` (string) - This setting specifies the directory that
artifacts from the build, such as the virtual machine files and disks,
will be output to. The path to the directory may be relative or
absolute. If relative, the path is relative to the working directory
`packer` is executed from. This directory must not exist or, if
created, must be empty prior to running the builder. By default this is
"output-BUILDNAME" where "BUILDNAME" is the name of the build.
<%= partial "partials/builder/hyperv/iso/Config-not-required" %>
<%= partial "partials/builder/hyperv/common/CommonConfig-not-required" %>
@include 'partials/builder/hyperv/iso/Config-not-required.mdx'
@include 'partials/builder/hyperv/common/CommonConfig-not-required.mdx'
## Http directory configuration reference
<%= partial "partials/common/HTTPConfig" %>
@include 'partials/common/HTTPConfig.mdx'
### Optional:
<%= partial "partials/common/HTTPConfig-not-required" %>
@include 'partials/common/HTTPConfig-not-required.mdx'
## Shutdown configuration reference
### Optional:
<%= partial "partials/common/shutdowncommand/ShutdownConfig-not-required" %>
@include 'partials/common/shutdowncommand/ShutdownConfig-not-required.mdx'
## Floppy configuration reference
<%= partial "partials/common/FloppyConfig" %>
@include 'partials/common/FloppyConfig.mdx'
### Optional:
<%= partial "partials/common/FloppyConfig-not-required" %>
@include 'partials/common/FloppyConfig-not-required.mdx'
## Boot Configuration Reference
<%= partial "partials/common/bootcommand/BootConfig" %>
@include 'partials/common/bootcommand/BootConfig.mdx'
### Optional:
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
@include 'partials/common/bootcommand/BootConfig-not-required.mdx'
## Integration Services
@ -135,7 +137,7 @@ mkisofs](http://opensourcepack.blogspot.co.uk/p/cdrtools.html) available.
Below is a working PowerShell script that can be used to create a Windows
answer ISO:
``` powershell
```powershell
$isoFolder = "answer-iso"
if (test-path $isoFolder){
remove-item $isoFolder -Force -Recurse
@ -177,7 +179,7 @@ Packer config:
{
"builders": [
{
"vm_name":"windows2012r2",
"vm_name": "windows2012r2",
"type": "hyperv-iso",
"disk_size": 61440,
"floppy_files": [],
@ -186,29 +188,27 @@ Packer config:
],
"http_directory": "./windows/common/http/",
"boot_wait": "0s",
"boot_command": [
"a<wait>a<wait>a"
],
"boot_command": ["a<wait>a<wait>a"],
"iso_url": "http://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO",
"iso_checksum_type": "md5",
"iso_checksum": "458ff91f8abc21b75cb544744bf92e6a",
"communicator":"winrm",
"communicator": "winrm",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout" : "4h",
"winrm_timeout": "4h",
"shutdown_command": "f:\\run-sysprep.cmd",
"memory": 4096,
"cpus": 4,
"generation": 2,
"switch_name":"LAN",
"enable_secure_boot":true
"switch_name": "LAN",
"enable_secure_boot": true
}
],
"provisioners": [
{
"type": "powershell",
"elevated_user":"vagrant",
"elevated_password":"vagrant",
"elevated_user": "vagrant",
"elevated_password": "vagrant",
"scripts": [
"./windows/common/install-7zip.ps1",
"./windows/common/install-chef.ps1",
@ -231,7 +231,7 @@ Packer config:
autounattend.xml:
``` xml
```xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
@ -632,7 +632,7 @@ Finish Setup cache proxy during installation -->
sysprep-unattend.xml:
``` xml
```xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="generalize">
@ -717,17 +717,17 @@ virtual switch with an `External` connection type.
},
"builders": [
{
"vm_name":"{{user `vm_name`}}",
"vm_name": "{{user `vm_name`}}",
"type": "hyperv-iso",
"disk_size": "{{user `disk_size`}}",
"guest_additions_mode": "disable",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"communicator":"ssh",
"communicator": "ssh",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_timeout" : "4h",
"ssh_timeout": "4h",
"http_directory": "./",
"boot_wait": "5s",
"boot_command": [
@ -755,7 +755,7 @@ virtual switch with an `External` connection type.
### preseed.cfg:
``` text
```text
## Options to set on the command line
d-i debian-installer/locale string en_US.utf8
d-i console-setup/ask_detect boolean false
@ -826,7 +826,7 @@ d-i pkgsel/update-policy select none
choose-mirror-bin mirror/http/proxy string
```
-> **Note for *nix guests:** Please note that packer requires the VM to be
-> **Note for \*nix guests:** Please note that packer requires the VM to be
running a hyper-v KVP daemon in order to detect the IP address of the guest VM.
On RHEL based machines this may require installing the package `hyperv-daemons`
and ensuring the `hypervkvpd` service is started at boot. On Debian based

View File

@ -1,11 +1,12 @@
---
modeline: |
vim: set ft=pandoc:
description: |-
The Hyper-V Packer builder is able to clone an existing Hyper-V virtual machine and export them.
layout: "docs"
sidebar_current: 'docs-builders-hyperv-vmcx'
page_title: "Hyper-V Builder (from a vmcx)"
description: >-
The Hyper-V Packer builder is able to clone an existing Hyper-V virtual
machine and export them.
layout: docs
sidebar_current: docs-builders-hyperv-vmcx
page_title: Hyper-V Builder (from a vmcx)
---
# Hyper-V Builder (from a vmcx)
@ -44,11 +45,11 @@ Clone from existing virtual machine:
```json
{
"clone_from_vm_name": "ubuntu-12.04.5-server-amd64",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
"ssh_password": "packer",
"ssh_username": "packer",
"type": "hyperv-vmcx"
"clone_from_vm_name": "ubuntu-12.04.5-server-amd64",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
"ssh_password": "packer",
"ssh_username": "packer",
"type": "hyperv-vmcx"
}
```
@ -71,36 +72,35 @@ builder.
## ISO Configuration Reference
<%= partial "partials/common/ISOConfig" %>
@include 'partials/common/ISOConfig.mdx'
### Required:
<%= partial "partials/common/ISOConfig-required" %>
@include 'partials/common/ISOConfig-required.mdx'
### Optional:
<%= partial "partials/common/ISOConfig-not-required" %>
@include 'partials/common/ISOConfig-not-required.mdx'
### Required for virtual machine import:
- `clone_from_vmcx_path` (string) - The path to a directory containing a
previously exported virtual machine. The exported machine will be used
as the source for new VM.
note: You should provide the named directory that contains the
"Virtual Machines", "Snapshots", and/or "Virtual Hard Disks" subdirectories,
not the .vmcx file itself.
- `clone_from_vmcx_path` (string) - The path to a directory containing a
previously exported virtual machine. The exported machine will be used
as the source for new VM.
note: You should provide the named directory that contains the
"Virtual Machines", "Snapshots", and/or "Virtual Hard Disks" subdirectories,
not the .vmcx file itself.
### Required for virtual machine clone:
- `clone_from_vm_name` (string) - The name of the VM to clone from. Ideally
the machine to clone from should be shutdown.
- `clone_from_vm_name` (string) - The name of the VM to clone from. Ideally
the machine to clone from should be shutdown.
### Optional:
<%= partial "partials/builder/hyperv/vmcx/Config-not-required" %>
<%= partial "partials/builder/hyperv/common/CommonConfig-not-required" %>
@include 'partials/builder/hyperv/vmcx/Config-not-required.mdx'
@include 'partials/builder/hyperv/common/CommonConfig-not-required.mdx'
## Boot Command
@ -116,7 +116,7 @@ the template.
The boot command is "typed" character for character over the virtual keyboard
to the machine, simulating a human actually typing the keyboard.
<%= partial "partials/builders/boot-command" %>
@include 'partials/builders/boot-command.mdx'
The example shown below is a working boot command used to start an Ubuntu
12.04 installer:
@ -162,7 +162,7 @@ mkisofs](http://opensourcepack.blogspot.co.uk/p/cdrtools.html) available.
Below is a working PowerShell script that can be used to create a Windows
answer ISO:
``` powershell
```powershell
$isoFolder = "answer-iso"
if (test-path $isoFolder){
remove-item $isoFolder -Force -Recurse
@ -204,7 +204,7 @@ Packer config:
{
"builders": [
{
"vm_name":"windows2012r2",
"vm_name": "windows2012r2",
"type": "hyperv-iso",
"disk_size": 61440,
"floppy_files": [],
@ -213,29 +213,27 @@ Packer config:
],
"http_directory": "./windows/common/http/",
"boot_wait": "0s",
"boot_command": [
"a<wait>a<wait>a"
],
"boot_command": ["a<wait>a<wait>a"],
"iso_url": "http://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO",
"iso_checksum_type": "md5",
"iso_checksum": "458ff91f8abc21b75cb544744bf92e6a",
"communicator":"winrm",
"communicator": "winrm",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout" : "4h",
"winrm_timeout": "4h",
"shutdown_command": "f:\\run-sysprep.cmd",
"memory": 4096,
"cpus": 4,
"generation": 2,
"switch_name":"LAN",
"enable_secure_boot":true
"switch_name": "LAN",
"enable_secure_boot": true
}
],
"provisioners": [
{
"type": "powershell",
"elevated_user":"vagrant",
"elevated_password":"vagrant",
"elevated_user": "vagrant",
"elevated_password": "vagrant",
"scripts": [
"./windows/common/install-7zip.ps1",
"./windows/common/install-chef.ps1",
@ -258,7 +256,7 @@ Packer config:
autounattend.xml:
``` xml
```xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
@ -659,7 +657,7 @@ Finish Setup cache proxy during installation -->
sysprep-unattend.xml:
``` xml
```xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="generalize">
@ -744,17 +742,17 @@ virtual switch with an `External` connection type.
},
"builders": [
{
"vm_name":"{{user `vm_name`}}",
"vm_name": "{{user `vm_name`}}",
"type": "hyperv-iso",
"disk_size": "{{user `disk_size`}}",
"guest_additions_mode": "disable",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"communicator":"ssh",
"communicator": "ssh",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_timeout" : "4h",
"ssh_timeout": "4h",
"http_directory": "./",
"boot_wait": "5s",
"boot_command": [
@ -782,7 +780,7 @@ virtual switch with an `External` connection type.
### preseed.cfg:
``` text
```text
## Options to set on the command line
d-i debian-installer/locale string en_US.utf8
d-i console-setup/ask_detect boolean false

View File

@ -0,0 +1,24 @@
---
description: |
The Hyper-V Packer builder is able to create Hyper-V virtual machines and
export them.
layout: docs
page_title: Hyper-V - Builders
sidebar_current: docs-builders-hyperv
---
# HyperV Builder
The HyperV Packer builder is able to create
[Hyper-V](https://www.microsoft.com/en-us/server-cloud/solutions/virtualization.aspx)
virtual machines and export them.
- [hyperv-iso](/docs/builders/hyperv-iso.html) - Starts from an ISO file,
creates a brand new Hyper-V VM, installs an OS, provisions software within
the OS, then exports that machine to create an image. This is best for
people who want to start from scratch.
- [hyperv-vmcx](/docs/builders/hyperv-vmcx.html) - Clones an an existing
virtual machine, provisions software within the OS, then exports that
machine to create an image. This is best for people who have existing base
images and want to customize them.

View File

@ -1,10 +1,10 @@
---
description: |
Builders are responsible for creating machines and generating images from them
for various platforms.
Builders are responsible for creating machines and generating images from them
for various platforms.
layout: docs
page_title: Builders
sidebar_current: 'docs-builders'
sidebar_current: docs-builders
---
# Builders

View File

@ -1,10 +1,10 @@
---
description: |
The `jdcloud` Packer builder helps you to build instance images
based on an existing image
The `jdcloud` Packer builder helps you to build instance images
based on an existing image
layout: docs
page_title: 'JDCloud Image Builder'
sidebar_current: 'docs-builders-jdcloud'
page_title: JDCloud Image Builder
sidebar_current: docs-builders-jdcloud
---
# JDCloud Image Builder
@ -17,12 +17,12 @@ based on an existing image
## Configuration Reference
In order to build a JDCloud instance image, full-fill your configuration file. Necessary attributes
are given below:
are given below:
### Required-Parameters:
- `type` (string) - This parameter tells which cloud-service-provider you are using, in our case, use 'jdcloud'
- `image_id` (string) - New image is generated based on an old one, specify the base-image-id here.
- `image_id` (string) - New image is generated based on an old one, specify the base-image-id here.
- `access_key` (string) - Your JD Cloud access key. You may set this as an env-variable:`export JDCLOUD_ACCESS_KEY=xxx`
- `secret_key` (string) - Your JD Cloud secret key. You may also set this via env-variable:`export JDCLOUD_SECRET_KEY=xxx`
- `region_id` (string) - Region of your instance, candidates are {"cn-north-1","cn-south-1","cn-east-1","cn-east-2"}
@ -36,7 +36,6 @@ are given below:
- `subnet_id` (string) - An instance is supposed to exists in an subnet, if not specified , we will create new one for you
## Examples
Here is a basic example for JDCloud.
@ -53,28 +52,22 @@ Here is a basic example for JDCloud.
"az": "cn-north-1c",
"instance_name": "created_by_packer",
"instance_type": "g.n2.medium",
"ssh_password":"/Users/mac/.ssh/id_rsa",
"ssh_keypair_name":"created_by_xiaohan",
"ssh_password": "/Users/mac/.ssh/id_rsa",
"ssh_keypair_name": "created_by_xiaohan",
"image_name": "packerImage",
"subnet_id": "subnet-jo6e38sdli",
"communicator":"ssh",
"ssh_username": "root",
"communicator": "ssh",
"ssh_username": "root"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 3",
"echo 123",
"pwd"
]
"inline": ["sleep 3", "echo 123", "pwd"]
}
]
}
```
[Find more examples](https://github.com/hashicorp/packer/tree/master/examples/jdcloud)

View File

@ -0,0 +1,101 @@
---
description: >
The linode Packer builder is able to create new images for use with Linode.
The
builder takes a source image, runs any provisioning necessary on the image
after launching it, then snapshots it into a reusable image. This reusable
image can then be used as the foundation of new servers that are launched
within all Linode regions.
layout: docs
page_title: Linode - Builders
sidebar_current: docs-builders-linode
---
# Linode Builder
Type: `linode`
The `linode` Packer builder is able to create [Linode
Images](https://www.linode.com/docs/platform/disk-images/linode-images/) for
use with [Linode](https://www.linode.com). The builder takes a source image,
runs any provisioning necessary on the image after launching it, then snapshots
it into a reusable image. This reusable image can then be used as the
foundation of new servers that are launched within Linode.
The builder does _not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required
- `linode_token` (string) - The client TOKEN to use to access your account.
- `image` (string) - An Image ID to deploy the Disk from. Official Linode
Images start with `linode/`, while user Images start with `private/`. See
[images](https://api.linode.com/v4/images) for more information on the
Images available for use. Examples are `linode/debian9`, `linode/fedora28`,
`linode/ubuntu18.04`, `linode/arch`, and `private/12345`.
- `region` (string) - The id of the region to launch the Linode instance in.
Images are available in all regions, but there will be less delay when
deploying from the region where the image was taken. Examples are
`us-east`, `us-central`, `us-west`, `ap-south`, `ca-east`, `ap-northeast`,
`eu-central`, and `eu-west`.
- `instance_type` (string) - The Linode type defines the pricing, CPU, disk,
and RAM specs of the instance. Examples are `g6-nanode-1`, `g6-standard-2`,
`g6-highmem-16`, and `g6-dedicated-16`.
### Optional
- `instance_label` (string) - The name assigned to the Linode Instance.
- `instance_tags` (list) - Tags to apply to the instance when it is created.
- `swap_size` (int) - The disk size (MiB) allocated for swap space.
- `image_label` (string) - The name of the resulting image that will appear
in your account. Defaults to "packer-{{timestamp}}" (see [configuration
templates](/docs/templates/engine.html) for more info).
- `image_description` (string) - The description of the resulting image that
will appear in your account. Defaults to "".
- `state_timeout` (string) - The time to wait, as a duration string, for the
Linode instance to enter a desired state (such as "running") before timing
out. The default state timeout is "5m".
## Basic Example
Here is a Linode builder example. The `linode_token` should be replaced with an
actual [Linode Personal Access
Token](https://www.linode.com/docs/platform/api/getting-started-with-the-linode-api/#get-an-access-token).
```json
{
"type": "linode",
"linode_token": "YOUR API TOKEN",
"image": "linode/debian9",
"region": "us-east",
"instance_type": "g6-nanode-1",
"instance_label": "temporary-linode-{{timestamp}}",
"image_label": "private-image-{{timestamp}}",
"image_description": "My Private Image",
"ssh_username": "root"
}
```

View File

@ -0,0 +1,126 @@
---
description: |
The `lxc` Packer builder builds containers for lxc1. The builder starts an LXC
container, runs provisioners within this container, then exports the container
as a tar.gz of the root file system.
layout: docs
page_title: LXC - Builders
sidebar_current: docs-builders-lxc\`
---
# LXC Builder
Type: `lxc`
The `lxc` Packer builder builds containers for lxc1. The builder starts an LXC
container, runs provisioners within this container, then exports the container
as a tar.gz of the root file system.
The LXC builder requires a modern linux kernel and the `lxc` or `lxc1` package.
This builder does not work with LXD.
\~&gt; Note: to build Centos images on a Debian family host, you will need the
`yum` package installed. <br />Some provisioners such as `ansible-local` get
confused when running in a container of a different family. E.G. it will
attempt to use `apt-get` to install packages, when running in a Centos
container if the parent OS is Debian based.
## Basic Example
Below is a fully functioning example.
```{.javascript}
{
"builders": [
{
"type": "lxc",
"name": "lxc-trusty",
"config_file": "/tmp/lxc/config",
"template_name": "ubuntu",
"template_environment_vars": [
"SUITE=trusty"
]
},
{
"type": "lxc",
"name": "lxc-xenial",
"config_file": "/tmp/lxc/config",
"template_name": "ubuntu",
"template_environment_vars": [
"SUITE=xenial"
]
},
{
"type": "lxc",
"name": "lxc-jessie",
"config_file": "/tmp/lxc/config",
"template_name": "debian",
"template_environment_vars": [
"SUITE=jessie"
]
},
{
"type": "lxc",
"name": "lxc-centos-7-x64",
"config_file": "/tmp/lxc/config",
"template_name": "centos",
"template_parameters": [
"-R","7",
"-a","x86_64"
]
}
]
}
```
## Configuration Reference
### Required:
- `config_file` (string) - The path to the lxc configuration file.
- `template_name` (string) - The LXC template name to use.
- `template_environment_vars` (array of strings) - Environmental variables to
use to build the template with.
### Optional:
- `target_runlevel` (number) - The minimum run level to wait for the
container to reach. Note some distributions (Ubuntu) simulate run levels
and may report 5 rather than 3.
- `output_directory` (string) - The directory in which to save the exported
tar.gz. Defaults to `output-<BuildName>` in the current directory.
- `container_name` (string) - The name of the LXC container. Usually stored
in `/var/lib/lxc/containers/<container_name>`. Defaults to
`packer-<BuildName>`.
- `command_wrapper` (string) - Allows you to specify a wrapper command, such
as `ssh` so you can execute packer builds on a remote host. Defaults to
Empty.
- `init_timeout` (string) - The timeout in seconds to wait for the the
container to start. Defaults to 20 seconds.
- `template_parameters` (array of strings) - Options to pass to the given
`lxc-template` command, usually located in
`/usr/share/lxc/templates/lxc-<template_name>`. Note: This gets passed as
ARGV to the template command. Ensure you have an array of strings, as a
single string with spaces probably won't work. Defaults to `[]`.
- `create_options` (array of strings) - Options to pass to `lxc-create`. For
instance, you can specify a custom LXC container configuration file with
`["-f", "/path/to/lxc.conf"]`. Defaults to `[]`. See `man 1 lxc-create` for
available options.
- `start_options` (array of strings) - Options to pass to `lxc-start`. For
instance, you can override parameters from the LXC container configuration
file via `["--define", "KEY=VALUE"]`. Defaults to `[]`. See
`man 1 lxc-start` for available options.
- `attach_options` (array of strings) - Options to pass to `lxc-attach`. For
instance, you can prevent the container from inheriting the host machine's
environment by specifying `["--clear-env"]`. Defaults to `[]`. See
`man 1 lxc-attach` for available options.

View File

@ -0,0 +1,84 @@
---
description: >
The `lxd` Packer builder builds containers for LXD. The builder starts an LXD
container, runs provisioners within this container, then saves the container
as
an LXD image.
layout: docs
page_title: LXD - Builders
sidebar_current: docs-builders-lxd
---
# LXD Builder
Type: `lxd`
The `lxd` Packer builder builds containers for LXD. The builder starts an LXD
container, runs provisioners within this container, then saves the container as
an LXD image.
The LXD builder requires a modern linux kernel and the `lxd` package. This
builder does not work with LXC.
## Basic Example
Below is a fully functioning example.
```{.javascript}
{
"builders": [
{
"type": "lxd",
"name": "lxd-xenial",
"image": "ubuntu-daily:xenial",
"output_image": "ubuntu-xenial",
"publish_properties": {
"description": "Trivial repackage with Packer"
}
}
]
}
```
## Configuration Reference
### Required:
- `image` (string) - The source image to use when creating the build
container. This can be a (local or remote) image (name or fingerprint).
E.G. `my-base-image`, `ubuntu-daily:x`, `08fababf6f27`, ...
\~&gt; Note: The builder may appear to pause if required to download a
remote image, as they are usually 100-200MB. `/var/log/lxd/lxd.log` will
mention starting such downloads.
### Optional:
- `init_sleep` (string) - The number of seconds to sleep between launching
the LXD instance and provisioning it; defaults to 3 seconds.
- `name` (string) - The name of the started container. Defaults to
`packer-$PACKER_BUILD_NAME`.
- `output_image` (string) - The name of the output artifact. Defaults to
`name`.
- `command_wrapper` (string) - Lets you prefix all builder commands, such as
with `ssh` for a remote build host. Defaults to `""`.
- `publish_properties` (map\[string\]string) - Pass key values to the publish
step to be set as properties on the output image. This is most helpful to
set the description, but can be used to set anything needed. See
<a
href="https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/"
class="uri"
>
https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/
</a>
for more properties.
- `launch_config` (map\[string\]string) - List of key/value pairs you wish to
pass to `lxc launch` via `--config`. Defaults to empty.

View File

@ -1,10 +1,10 @@
---
description: |
The ncloud builder allows you to create server images using the NAVER Cloud
Platform.
The ncloud builder allows you to create server images using the NAVER Cloud
Platform.
layout: docs
page_title: 'Naver Cloud Platform - Builders'
sidebar_current: 'docs-builders-ncloud'
page_title: Naver Cloud Platform - Builders
sidebar_current: docs-builders-ncloud
---
# NAVER CLOUD PLATFORM Builder
@ -16,51 +16,51 @@ Platform](https://www.ncloud.com/).
### Required:
- `ncloud_access_key` (string) - User's access key. Go to [\[Account
Management &gt; Authentication
Key\]](https://www.ncloud.com/mypage/manage/authkey) to create and view
your authentication key.
- `ncloud_access_key` (string) - User's access key. Go to [\[Account
Management &gt; Authentication
Key\]](https://www.ncloud.com/mypage/manage/authkey) to create and view
your authentication key.
- `ncloud_secret_key` (string) - User's secret key paired with the access
key. Go to [\[Account Management &gt; Authentication
Key\]](https://www.ncloud.com/mypage/manage/authkey) to create and view
your authentication key.
- `ncloud_secret_key` (string) - User's secret key paired with the access
key. Go to [\[Account Management &gt; Authentication
Key\]](https://www.ncloud.com/mypage/manage/authkey) to create and view
your authentication key.
- `server_image_product_code` (string) - Product code of an image to create.
(member\_server\_image\_no is required if not specified)
- `server_image_product_code` (string) - Product code of an image to create.
(member_server_image_no is required if not specified)
- `server_product_code` (string) - Product (spec) code to create.
- `server_product_code` (string) - Product (spec) code to create.
### Optional:
- `member_server_image_no` (string) - Previous image code. If there is an
image previously created, it can be used to create a new image.
(`server_image_product_code` is required if not specified)
- `member_server_image_no` (string) - Previous image code. If there is an
image previously created, it can be used to create a new image.
(`server_image_product_code` is required if not specified)
- `server_image_name` (string) - Name of an image to create.
- `server_image_name` (string) - Name of an image to create.
- `server_image_description` (string) - Description of an image to create.
- `server_image_description` (string) - Description of an image to create.
- `block_storage_size` (number) - You can add block storage ranging from 10
GB to 2000 GB, in increments of 10 GB.
- `block_storage_size` (number) - You can add block storage ranging from 10
GB to 2000 GB, in increments of 10 GB.
- `access_control_group_configuration_no` (string) - This is used to allow
winrm access when you create a Windows server. An ACG that specifies an
access source (`0.0.0.0/0`) and allowed port (5985) must be created in
advance.
- `access_control_group_configuration_no` (string) - This is used to allow
winrm access when you create a Windows server. An ACG that specifies an
access source (`0.0.0.0/0`) and allowed port (5985) must be created in
advance.
- `user_data` (string) - User data to apply when launching the instance. Note
that you need to be careful about escaping characters due to the templates
being JSON. It is often more convenient to use `user_data_file`, instead.
Packer will not automatically wait for a user script to finish before
shutting down the instance this must be handled in a provisioner.
- `user_data` (string) - User data to apply when launching the instance. Note
that you need to be careful about escaping characters due to the templates
being JSON. It is often more convenient to use `user_data_file`, instead.
Packer will not automatically wait for a user script to finish before
shutting down the instance this must be handled in a provisioner.
- `user_data_file` (string) - Path to a file that will be used for the user
data when launching the instance.
- `user_data_file` (string) - Path to a file that will be used for the user
data when launching the instance.
- `region` (string) - Name of the region where you want to create an image.
(default: Korea)
- values: Korea / US-West / HongKong / Singapore / Japan / Germany
- `region` (string) - Name of the region where you want to create an image.
(default: Korea)
- values: Korea / US-West / HongKong / Singapore / Japan / Germany
## Sample code of template.json
@ -143,11 +143,11 @@ provision when creating a Windows server.
## Note
- You can only create as many public IP addresses as the number of server
instances you own. Before running Packer, please make sure that the number
of public IP addresses previously created is not larger than the number of
server instances (including those to be used to create server images).
- When you forcibly terminate the packer process or close the terminal
(command) window where the process is running, the resources may not be
cleaned up as the packer process no longer runs. In this case, you should
manually clean up the resources associated with the process.
- You can only create as many public IP addresses as the number of server
instances you own. Before running Packer, please make sure that the number
of public IP addresses previously created is not larger than the number of
server instances (including those to be used to create server images).
- When you forcibly terminate the packer process or close the terminal
(command) window where the process is running, the resources may not be
cleaned up as the packer process no longer runs. In this case, you should
manually clean up the resources associated with the process.

View File

@ -1,12 +1,12 @@
---
description: |
The null Packer builder is not really a builder, it just sets up an SSH
connection and runs the provisioners. It can be used to debug provisioners
without incurring high wait times. It does not create any kind of image or
artifact.
The null Packer builder is not really a builder, it just sets up an SSH
connection and runs the provisioners. It can be used to debug provisioners
without incurring high wait times. It does not create any kind of image or
artifact.
layout: docs
page_title: 'Null - Builders'
sidebar_current: 'docs-builders-null'
page_title: Null - Builders
sidebar_current: docs-builders-null
---
# Null Builder
@ -25,8 +25,8 @@ provisioners are defined, but it will connect to the specified host via ssh.
```json
{
"type": "null",
"ssh_host": "127.0.0.1",
"type": "null",
"ssh_host": "127.0.0.1",
"ssh_username": "foo",
"ssh_password": "bar"
}

View File

@ -0,0 +1,66 @@
---
description: The 1&1 builder is able to create images for 1&1 cloud.
layout: docs
page_title: 1&1 - Builders
sidebar_current: docs-builders-oneandone
---
# 1&1 Builder
Type: `oneandone`
The 1&1 Builder is able to create virtual machines for
[1&1](https://www.1and1.com/).
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required
- `source_image_name` (string) - 1&1 Server Appliance name of type `IMAGE`.
- `token` (string) - 1&1 REST API Token. This can be specified via
environment variable `ONEANDONE_TOKEN`
### Optional
- `data_center_name` - Name of virtual data center. Possible values "ES",
"US", "GB", "DE". Default value "US"
- `disk_size` (string) - Amount of disk space for this image in GB. Defaults
to "50"
- `image_name` (string) - Resulting image. If "image_name" is not provided
Packer will generate it
- `retries` (number) - Number of retries Packer will make status requests
while waiting for the build to complete. Default value "600".
- `url` (string) - Endpoint for the 1&1 REST API. Default URL
"<https://cloudpanel-api.1and1.com/v1>"
## Example
Here is a basic example:
```json
{
"builders": [
{
"type": "oneandone",
"disk_size": "50",
"image_name": "test5",
"source_image_name": "ubuntu1604-64min",
"ssh_username": "root",
"ssh_private_key_file": "/path/to/private/ssh/key"
}
]
}
```

View File

@ -1,13 +1,18 @@
---
description: |
The openstack Packer builder is able to create new images for use with
OpenStack. The builder takes a source image, runs any provisioning necessary on
the image after launching it, then creates a new reusable image. This reusable
image can then be used as the foundation of new servers that are launched
within OpenStack.
description: >
The openstack Packer builder is able to create new images for use with
OpenStack. The builder takes a source image, runs any provisioning necessary
on
the image after launching it, then creates a new reusable image. This reusable
image can then be used as the foundation of new servers that are launched
within OpenStack.
layout: docs
page_title: 'OpenStack - Builders'
sidebar_current: 'docs-builders-openstack'
page_title: OpenStack - Builders
sidebar_current: docs-builders-openstack
---
# OpenStack Builder
@ -22,7 +27,7 @@ servers that are launched within OpenStack. The builder will create temporary
keypairs that provide temporary access to the server while the image is being
created. This simplifies configuration quite a bit.
The builder does *not* manage images. Once it creates an image, it is up to you
The builder does _not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
\~&gt; **Note:** To use OpenStack builder with the OpenStack Newton (Oct 2016)
@ -30,7 +35,7 @@ or earlier, we recommend you use Packer v1.1.2 or earlier version.
\~&gt; **OpenStack Liberty or later requires OpenSSL!** To use the OpenStack
builder with OpenStack Liberty (Oct 2015) or later you need to have OpenSSL
installed *if you are using temporary key pairs*, i.e. don't use
installed _if you are using temporary key pairs_, i.e. don't use
[`ssh_keypair_name`](openstack.html#ssh_keypair_name) nor
[`ssh_password`](/docs/templates/communicator.html#ssh_password). All major
OS'es have OpenSSL installed by default except Windows. This have been resolved
@ -52,24 +57,23 @@ builder.
### Required:
<%= partial "partials/builder/openstack/AccessConfig-required" %>
<%= partial "partials/builder/openstack/ImageConfig-required" %>
<%= partial "partials/builder/openstack/RunConfig-required" %>
@include 'partials/builder/openstack/AccessConfig-required.mdx'
@include 'partials/builder/openstack/ImageConfig-required.mdx'
@include 'partials/builder/openstack/RunConfig-required.mdx'
### Optional:
<%= partial "partials/builder/openstack/AccessConfig-not-required" %>
<%= partial "partials/builder/openstack/ImageConfig-not-required" %>
<%= partial "partials/builder/openstack/RunConfig-not-required" %>
@include 'partials/builder/openstack/AccessConfig-not-required.mdx'
@include 'partials/builder/openstack/ImageConfig-not-required.mdx'
@include 'partials/builder/openstack/RunConfig-not-required.mdx'
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/helper/communicator/SSH-not-required" %>
<%= partial "partials/helper/communicator/SSHInterface-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/helper/communicator/SSH-not-required.mdx'
@include 'partials/helper/communicator/SSHInterface-not-required.mdx'
## Basic Example: DevStack
@ -131,18 +135,18 @@ appear in the template. That is because I source a standard OpenStack script
with environment variables set before I run this. This script is setting
environment variables like:
- `OS_AUTH_URL`
- `OS_TENANT_ID`
- `OS_USERNAME`
- `OS_PASSWORD`
- `OS_AUTH_URL`
- `OS_TENANT_ID`
- `OS_USERNAME`
- `OS_PASSWORD`
This is slightly different when identity v3 is used:
- `OS_AUTH_URL`
- `OS_USERNAME`
- `OS_PASSWORD`
- `OS_DOMAIN_NAME`
- `OS_TENANT_NAME`
- `OS_AUTH_URL`
- `OS_USERNAME`
- `OS_PASSWORD`
- `OS_DOMAIN_NAME`
- `OS_TENANT_NAME`
This will authenticate the user on the domain and scope you to the project. A
tenant is the same as a project. It's optional to use names or IDs in v3. This
@ -151,7 +155,7 @@ means you can use `OS_USERNAME` or `OS_USERID`, `OS_TENANT_ID` or
The above example would be equivalent to an RC file looking like this :
``` shell
```shell
export OS_AUTH_URL="https://identity.myprovider/v3"
export OS_USERNAME="myuser"
export OS_PASSWORD="password"
@ -187,9 +191,9 @@ by Selectel VPC.
## Notes on OpenStack Authorization
The simplest way to get all settings for authorization against OpenStack is to
go into the OpenStack Dashboard (Horizon) select your *Project* and navigate
*Project, Access & Security*, select *API Access* and *Download OpenStack RC
File v3*. Source the file, and select your wanted region by setting environment
go into the OpenStack Dashboard (Horizon) select your _Project_ and navigate
_Project, Access & Security_, select _API Access_ and _Download OpenStack RC
File v3_. Source the file, and select your wanted region by setting environment
variable `OS_REGION_NAME` or `OS_REGION_ID` and
`export OS_TENANT_NAME=$OS_PROJECT_NAME` or
`export OS_TENANT_ID=$OS_PROJECT_ID`.
@ -208,9 +212,9 @@ To authorize with a access token only `identity_endpoint` and `token` is
needed, and possibly `tenant_name` or `tenant_id` depending on your token type.
Or use the following environment variables:
- `OS_AUTH_URL`
- `OS_TOKEN`
- One of `OS_TENANT_NAME` or `OS_TENANT_ID`
- `OS_AUTH_URL`
- `OS_TOKEN`
- One of `OS_TENANT_NAME` or `OS_TENANT_ID`
### Authorize Using Application Credential
@ -218,6 +222,6 @@ To authorize with an application credential, only `identity_endpoint`,
`application_credential_id`, and `application_credential_secret` are needed.
Or use the following environment variables:
- `OS_AUTH_URL`
- `OS_APPLICATION_CREDENTIAL_ID`
- `OS_APPLICATION_CREDENTIAL_SECRET`
- `OS_AUTH_URL`
- `OS_APPLICATION_CREDENTIAL_ID`
- `OS_APPLICATION_CREDENTIAL_SECRET`

View File

@ -0,0 +1,311 @@
---
description: |
The oracle-classic builder is able to create new custom images for use with
Oracle Cloud Infrastructure Classic Compute.
layout: docs
page_title: Oracle Cloud Infrastructure Classic - Builders
sidebar_current: docs-builders-oracle-classic
---
# Oracle Cloud Infrastructure Classic Compute Builder
Type: `oracle-classic`
The `oracle-classic` Packer builder is able to create custom images for use
with [Oracle Cloud Infrastructure Classic
Compute](https://cloud.oracle.com/compute-classic). The builder takes a base
image, runs any provisioning necessary on the base image after launching it,
and finally snapshots it creating a reusable custom image.
It is recommended that you familiarise yourself with the [Key Concepts and
Terminology](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/terminology.html)
prior to using this builder if you have not done so already.
The builder _does not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
## Authorization
This builder authenticates API calls to Oracle Cloud Infrastructure Classic
Compute using basic authentication (user name and password). To read more, see
the [authentication
documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/Authentication.html)
## Configuration Reference
There are many configuration options available for the `oracle-classic`
builder. This builder currently only works with the SSH communicator.
### Required
- `api_endpoint` (string) - This is your custom API endpoint for sending
requests. Instructions for determining your API endpoint can be found
[here](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/SendRequests.html)
- `dest_image_list` (string) - Where to save the machine image to once you've
provisioned it. If the provided image list does not exist, Packer will
create it.
- `identity_domain` (string) - This is your customer-specific identity domain
as generated by Oracle. If you don't know what your identity domain is, ask
your account administrator. For a little more information, see the Oracle
[documentation](https://docs.oracle.com/en/cloud/get-started/subscriptions-cloud/ocuid/identity-domain-overview.html#GUID-7969F881-5F4D-443E-B86C-9044C8085B8A).
- `source_image_list` (string) - This is what image you want to use as your
base image. See the
[documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/listing-machine-images.html)
for more details. You may use either a public image list, or a private
image list. To see what public image lists are available, you can use the
CLI, as described
[here](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stopc/image-lists-stclr-and-nmcli.html#GUID-DB7E75FE-F752-4FF7-AB70-3C8DCDFCA0FA)
- `source_image_list_entry` (string) - The entry identifying the machine
image to use in the image list. Defaults to the latest available entry.
- `password` (string) - Your account password.
- `shape` (string) - The template that determines the number of CPUs, amount
of memory, and other resources allocated to a newly created instance. For
more information about shapes, see the documentation
[here](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/machine-images-and-shapes.html).
- `username` (string) - Your account username.
### Optional
- `attributes` (string) - (string) - Attributes to apply when launching the
instance. Note that you need to be careful about escaping characters due to
the templates being JSON. It is often more convenient to use
`attributes_file`, instead. You may only define either `attributes` or
`attributes_file`, not both.
- `attributes_file` (string) - Path to a json file that will be used for the
attributes when launching the instance. You may only define either
`attributes` or `attributes_file`, not both.
- `image_description` (string) - a description for your destination image
list. If you don't provide one, Packer will provide a generic description.
- `ssh_username` (string) - The username that Packer will use to SSH into the
instance; required if using SSH. The default oracle user with sudo
privileges is `opc`, so you may set `ssh_username` to `opc` if you have not
yet configured users on your machine. If you have already configured users
on your machine, you may prompt Packer to use one of those instead. For
more detail, see the
[documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/accessing-oracle-linux-instance-using-ssh.html).
- `image_name` (string) - The name to assign to the resulting custom image.
- `persistent_volume_size` (int) - Size in gigabytes of the persistent boot
storage volume to build the image on. Use this if you want a bigger volume
than what instance storage provides. Note that using this option puts the
builder into a "persistent volume" mode, which is substantially different
than the default snapshot mode. Please see the configuration section below
for additional configuration options.
- `snapshot_timeout` (string) - How long to wait for a snapshot to be
created. Expects a positive golang Time.Duration string, which is a
sequence of decimal numbers and a unit suffix; valid suffixes are `ns`
(nanoseconds), `us` (microseconds), `ms` (milliseconds), `s` (seconds), `m`
(minutes), and `h` (hours). Examples of valid inputs: `100ms`, `250ms`,
`1s`, `2.5s`, `2.5m`, `1m30s`. Example: `"snapshot_timeout": "15m"`.
Default: `20m`.
### Persistent Volume Build
You will use this type of build if you've set the `persistent_volume_size`
option. If you need a bigger disk than what you normally get with instance
storage, you'll want to set this.
In the _persistent volume_ mode, things are built a little differently.
Normally, we launch an instance, then provision it and take a snapshot, which
becomes your machine image. This relies on the disk of the created instance
being large enough to perform your entire provisioning process. If that disk
size isn't sufficient, we can build with a persistent volume of arbitrary size.
First, we create a persistent volume of the requested size. This volume is
bootable and initialized with your image list. We start an instance with this
volume as the boot volume. After this instance launches, we provision and
terminate it, leaving the persistent volume around.
Next, we create a second instance, the "builder", this time booting from
instance storage. We also attach a new persistent volume, making it twice the
size of the original. We connect to this instance and copy the contents of the
first volume into a tarball file on the second volume. We then upload this file
to Object Storage Classic, and create a new machine image with it.
For more details, see this [blog
post](https://blogs.oracle.com/cloudmarketplace/creating-an-oracle-compute-machine-image-from-an-instance-with-persistent-boot-storage),
which discusses the strategy used here.
If this is set, a few more options become available.
- `builder_communicator` (communicator) - This represents an
[`ssh communicator`](/docs/templates/communicator.html#ssh-communicator),
and can be configured as such. If you use a different builder image, you
may need to change the `ssh_username`, for example. That might look like
this:
```json
{
"builders": [
{
"builder_communicator": {
"ssh_username": "soandso"
},
"type": "oracle-classic"
}
]
}
```
- `builder_image_list` (string) - This is the image to use for the builder
instance. This _must_ be a linux image, and Oracle Linux is recommended.
Default: `/oracle/public/OL_7.2_UEKR4_x86_64`.
- `builder_image_list_entry` (string) - The entry identifying the machine
image to use in the image list. If `builder_image_list` is unset, this
defaults to `5`, which is a working image as of this time. Otherwise, it
defaults to the latest entry. Set this to `0` to force it to use the latest
entry when using the default `builder_image_list`.
- `builder_shape` (string) - The template that determines the number of CPUs,
amount of memory, and other resources allocated to the builder instance.
Default: `oc3`.
- `builder_upload_image_command` (string) - The command to run to upload the
image to Object Storage Classic. This is for advanced users only, and you
should consult the default in code to decide on the changes to make. For
most users the default should suffice. If you choose to write your own,
this command is a template engine and can make use of the following
variables: `{{ .Username }}`, `{{ .Password }}`, `{{ .AccountID }}`,
`{{ .ImageFile }}`, and `{{ .SegmentPath }}`.
## Basic Example
Here is a basic example. Note that account specific configuration has been
obfuscated; you will need to add a working `username`, `password`,
`identity_domain`, and `api_endpoint` in order for the example to work.
```json
{
"builders": [
{
"type": "oracle-classic",
"username": "myuser@myaccount.com",
"password": "supersecretpasswordhere",
"identity_domain": "#######",
"api_endpoint": "https://api-###.compute.###.oraclecloud.com/",
"source_image_list": "/oracle/public/OL_7.2_UEKR4_x86_64",
"shape": "oc3",
"image_name": "Packer_Builder_Test_{{timestamp}}",
"attributes": "{\"userdata\": {\"pre-bootstrap\": {\"script\": [\"...\"]}}}",
"dest_image_list": "Packer_Builder_Test_List"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["echo hello"]
}
]
}
```
## Basic Example -- Windows
Attributes file is optional for connecting via ssh, but required for winrm.
The following file contains the bare minimum necessary to get winRM working;
you have to give it the password to give to the "Administrator" user, which
will be the one winrm connects to. You must also whitelist your computer to
connect via winRM -- the empty braces below whitelist any computer to access
winRM but you can make it more secure by only allowing your build machine
access. See the
[docs](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/automating-instance-initialization-using-opc-init.html#GUID-A0A107D6-3B38-47F4-8FC8-96D50D99379B)
for more details on how to define a trusted host.
Save this file as `windows_attributes.json`:
```json
{
"userdata": {
"administrator_password": "password",
"winrm": {}
}
}
```
Following is a minimal but working Packer config that references this
attributes file:
```json
{
"variables": {
"opc_username": "{{ env `OPC_USERNAME`}}",
"opc_password": "{{ env `OPC_PASSWORD`}}",
"opc_identity_domain": "{{env `OPC_IDENTITY_DOMAIN`}}",
"opc_api_endpoint": "{{ env `OPC_ENDPOINT`}}"
},
"builders": [
{
"type": "oracle-classic",
"username": "{{ user `opc_username`}}",
"password": "{{ user `opc_password`}}",
"identity_domain": "{{ user `opc_identity_domain`}}",
"api_endpoint": "{{ user `opc_api_endpoint`}}",
"source_image_list": "/Compute-{{ user `opc_identity_domain` }}/{{ user `opc_username`}}/Microsoft_Windows_Server_2012_R2-17.3.6-20170930-124649",
"attributes_file": "./windows_attributes.json",
"shape": "oc3",
"image_name": "Packer_Windows_Demo_{{timestamp}}",
"dest_image_list": "Packer_Windows_Demo",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_password": "password"
}
],
"provisioners": [
{
"type": "powershell",
"inline": "Write-Output(\"HELLO WORLD\")"
}
]
}
```
## Persistent Volume Example
Here is an example using a persistent volume. Note the `persistent_volume_size`
setting.
```json
{
"variables": {
"opc_username": "{{ env `OPC_USERNAME`}}",
"opc_password": "{{ env `OPC_PASSWORD`}}",
"opc_identity_domain": "{{env `OPC_IDENTITY_DOMAIN`}}",
"opc_api_endpoint": "{{ env `OPC_ENDPOINT`}}"
},
"builders": [
{
"type": "oracle-classic",
"username": "{{ user `opc_username`}}",
"password": "{{ user `opc_password`}}",
"identity_domain": "{{ user `opc_identity_domain`}}",
"api_endpoint": "{{ user `opc_api_endpoint`}}",
"source_image_list": "/oracle/public/OL_7.2_UEKR4_x86_64",
"persistent_volume_size": 15,
"image_name": "Packer_Builder_Test_{{timestamp}}",
"dest_image_list": "Packer_Builder_Test_List",
"ssh_username": "opc",
"shape": "oc3"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["echo hello"]
}
]
}
```

View File

@ -0,0 +1,242 @@
---
description: |
The oracle-oci builder is able to create new custom images for use with Oracle
Cloud Infrastructure (OCI).
layout: docs
page_title: 'Oracle OCI - Builders'
sidebar_current: 'docs-builders-oracle-oci'
---
# Oracle Cloud Infrastructure (OCI) Builder
Type: `oracle-oci`
The `oracle-oci` Packer builder is able to create new custom images for use
with [Oracle Cloud Infrastructure](https://cloud.oracle.com) (OCI). The builder
takes a base image, runs any provisioning necessary on the base image after
launching it, and finally snapshots it creating a reusable custom image.
It is recommended that you familiarise yourself with the [Key Concepts and
Terminology](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm)
prior to using this builder if you have not done so already.
The builder _does not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
## Authorization
The Oracle OCI API requires that requests be signed with the RSA public key
associated with your
[IAM](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm)
user account. For a comprehensive example of how to configure the required
authentication see the documentation on [Required Keys and
OCIDs](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm)
([Oracle Cloud
IDs](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm)).
Alternatively you can use [Instance
Principals](https://docs.cloud.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm)
in which case you don't need the above user authorization.
## Configuration Reference
There are many configuration options available for the `oracle-oci` builder. In
addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required
- `availability_domain` (string) - The name of the [Availability
Domain](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm)
within which a new instance is launched and provisioned. The names of the
Availability Domains have a prefix that is specific to your
[tenancy](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm#two).
To get a list of the Availability Domains, use the
[ListAvailabilityDomains](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/latest/AvailabilityDomain/ListAvailabilityDomains)
operation, which is available in the IAM Service API.
- `base_image_ocid` (string) - The OCID of the [base
image](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm)
to use. This is the unique identifier of the image that will be used to
launch a new instance and provision it.
To get a list of the accepted image OCIDs, use the
[ListImages](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/latest/Image/ListImages)
operation available in the Core Services API.
- `compartment_ocid` (string) - The OCID of the
[compartment](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/choosingcompartments.htm)
- `shape` (string) - The template that determines the number of CPUs, amount
of memory, and other resources allocated to a newly created instance.
To get a list of the available shapes, use the
[ListShapes](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Shape/ListShapes)
operation available in the Core Services API.
- `subnet_ocid` (string) - The name of the subnet within which a new instance
is launched and provisioned.
To get a list of your subnets, use the
[ListSubnets](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/latest/Subnet/ListSubnets)
operation available in the Core Services API.
Note: the subnet must be configured to allow access via your chosen
[communicator](/docs/templates/communicator.html) (communicator defaults to
[SSH tcp/22](/docs/templates/communicator.html#ssh_port)).
### Optional
- `use_instance_principals` (boolean) - Whether to use [Instance
Principals](https://docs.cloud.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm)
instead of User Principals. If this key is set to true, setting any one of the `access_cfg_file`,
`access_cfg_file_account`, `region`, `tenancy_ocid`, `user_ocid`, `key_file`, `fingerprint`,
`pass_phrase` will result in configuration validation errors.
Defaults to `false`.
- `access_cfg_file` (string) - The path to the [OCI config
file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm).
This cannot be used along with the `use_instance_principals` key.
Defaults to `$HOME/.oci/config`.
- `access_cfg_file_account` (string) - The specific account in the [OCI config
file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) to use.
This cannot be used along with the `use_instance_principals` key.
Defaults to `DEFAULT`.
- `region` (string) - An Oracle Cloud Infrastructure region. Overrides value provided by the
[OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
if present. This cannot be used along with the `use_instance_principals` key.
- `tenancy_ocid` (string) - The OCID of your tenancy. Overrides value provided by the [OCI config
file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present.
This cannot be used along with the `use_instance_principals` key.
- `user_ocid` (string) - The OCID of the user calling the OCI API. Overrides value provided by the
[OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
if present. This cannot be used along with the `use_instance_principals` key.
- `key_file` (string) - Full path and filename of the OCI API signing key. Overrides value provided
by the [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
if present. This cannot be used along with the `use_instance_principals` key.
- `fingerprint` (string) - Fingerprint for the OCI API signing key. Overrides value provided by the
[OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if
present. This cannot be used along with the `use_instance_principals` key.
- `pass_phrase` (string) - Pass phrase used to decrypt the OCI API signing key. Overrides value provided
by the [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm)
if present. This cannot be used along with the `use_instance_principals` key.
- `image_name` (string) - The name to assign to the resulting custom image.
- `instance_name` (string) - The name to assign to the instance used for the image creation process.
If not set a name of the form `instanceYYYYMMDDhhmmss` will be used.
- `use_private_ip` (boolean) - Use private ip addresses to connect to the
instance via ssh.
- `metadata` (map of strings) - Metadata optionally contains custom metadata
key/value pairs provided in the configuration. While this can be used to
set metadata\["user_data"\] the explicit "user_data" and
"user_data_file" values will have precedence. An instance's metadata can
be obtained from at [http://169.254.169.254](http://169.254.169.254) on the launched instance.
- `user_data` (string) - User data to be used by cloud-init. See [the Oracle
docs](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails)
for more details. Generally speaking, it is easier to use the
`user_data_file`, but you can use this option to put either the plaintext
data or the base64 encoded data directly into your Packer config. Packer
will not automatically wait for a user script to finish before shutting
down the instance this must be handled in a provisioner.
- `user_data_file` (string) - Path to a file to be used as user data by
cloud-init. See [the Oracle
docs](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails)
for more details. Example: `"user_data_file": "./boot_config/myscript.sh"`
- `tags` (map of strings) - Add one or more freeform tags to the resulting
custom image. See [the Oracle
docs](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm)
for more details. Example:
```{.yaml}
"tags":
"tag1": "value1"
"tag2": "value2"
```
- `defined_tags` (map of map of strings) - Add one or more defined tags for a given namespace to the resulting
custom image. See [the Oracle
docs](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/taggingoverview.htm)
for more details. Example:
```{.yaml}
"tags":
"namespace": {
"tag1": "value1",
"tag2": "value2"
}
```
## Basic Example
Here is a basic example. Note that account specific configuration has been
substituted with the letter `a` and OCIDS have been shortened for brevity.
```json
{
"availability_domain": "aaaa:PHX-AD-1",
"base_image_ocid": "ocid1.image.oc1.phx.aaaaaaaa5yu6pw3riqtuhxzov7fdngi4tsteganmao54nq3pyxu3hxcuzmoa",
"compartment_ocid": "ocid1.compartment.oc1..aaa",
"image_name": "ExampleImage",
"shape": "VM.Standard1.1",
"ssh_username": "opc",
"subnet_ocid": "ocid1.subnet.oc1..aaa",
"type": "oracle-oci"
}
```
## Using Instance Principals
Here is a basic example. Note that account specific configuration has been
substituted with the letter `a` and OCIDS have been shortened for brevity.
```json
{
"use_instance_principals": "true",
"availability_domain": "aaaa:PHX-AD-1",
"base_image_ocid": "ocid1.image.oc1.phx.aaaaaaaa5yu6pw3riqtuhxzov7fdngi4tsteganmao54nq3pyxu3hxcuzmoa",
"compartment_ocid": "ocid1.compartment.oc1..aaa",
"image_name": "ExampleImage",
"shape": "VM.Standard2.1",
"ssh_username": "opc",
"subnet_ocid": "ocid1.subnet.oc1..aaa",
"type": "oracle-oci"
}
```
```text
[opc@packerhost ~]$ packer build packer.json
oracle-oci: output will be in this color.
==> oracle-oci: Creating temporary ssh key for instance...
==> oracle-oci: Creating instance...
==> oracle-oci: Created instance (ocid1.instance.oc1.phx.aaa).
==> oracle-oci: Waiting for instance to enter 'RUNNING' state...
==> oracle-oci: Instance 'RUNNING'.
==> oracle-oci: Instance has IP: 10.10.10.10.
==> oracle-oci: Using ssh communicator to connect: 10.10.10.10
==> oracle-oci: Waiting for SSH to become available...
==> oracle-oci: Connected to SSH!
==> oracle-oci: Creating image from instance...
==> oracle-oci: Image created.
==> oracle-oci: Terminating instance (ocid1.instance.oc1.phx.aaa)...
==> oracle-oci: Terminated instance.
Build 'oracle-oci' finished.
==> Builds finished. The artifacts of successful builds are:
--> oracle-oci: An image was created: 'ExampleImage' (OCID: ocid1.image.oc1.phx.aaa) in region 'us-phoenix-1'
[opc@packerhost ~]$
```

View File

@ -0,0 +1,21 @@
---
description: Packer is able to create custom images using Oracle Cloud Infrastructure.
layout: docs
page_title: Oracle - Builders
sidebar_current: docs-builders-oracle
---
# Oracle Builder
Packer is able to create custom images on both Oracle Cloud Infrastructure and
Oracle Cloud Infrastructure Classic Compute. Packer comes with builders
designed to support both platforms. Please choose the one that's right for you:
- [oracle-classic](/docs/builders/oracle-classic.html) - Create custom images
in Oracle Cloud Infrastructure Classic Compute by launching a source
instance and creating an image list from a snapshot of it after
provisioning.
- [oracle-oci](/docs/builders/oracle-oci.html) - Create custom images in
Oracle Cloud Infrastructure (OCI) by launching a base instance and creating
an image from it after provisioning.

View File

@ -1,11 +1,14 @@
---
description: |
The osc-bsu Packer builder is able to create Outscale OMIs backed by BSU volumes for use in Outscale. For more information on the difference between
BSU-backed VMs and VM-store backed VMs, see the storage for
the root device section in the Outscale documentation.
description: >
The osc-bsu Packer builder is able to create Outscale OMIs backed by BSU
volumes for use in Outscale. For more information on the difference between
BSU-backed VMs and VM-store backed VMs, see the storage for
the root device section in the Outscale documentation.
layout: docs
page_title: 'Outscale BSU - Builders'
sidebar_current: 'docs-builders-osc-bsubacked'
page_title: Outscale BSU - Builders
sidebar_current: docs-builders-osc-bsubacked
---
# OMI Builder (BSU backed)
@ -25,7 +28,7 @@ keypairs, security group rules, etc. that provide it temporary access to the
VM while the image is being created. This simplifies configuration quite
a bit.
The builder does *not* manage OMIs. Once it creates an OMI and stores it in
The builder does _not_ manage OMIs. Once it creates an OMI and stores it in
your account, it is up to you to use, delete, etc. the OMI.
-&gt; **Note:** Temporary resources are, by default, all created with the
@ -63,13 +66,13 @@ builder.
- `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build.
- `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping.
- `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information
- `no_device` (boolean) - Suppresses the specified device included in the
block device mapping of the OMI
block device mapping of the OMI
- `snapshot_id` (string) - The ID of the snapshot
@ -80,7 +83,7 @@ builder.
- `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes
- `omi_description` (string) - The description to set for the resulting OMI(s). By default this description is empty. This is a [template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
data](#build-template-data) for more information.
- `omi_account_ids` (array of strings) - A list of account IDs that have access to launch the resulting OMI(s). By default no additional users other than the user creating the OMIS has permissions to launch it.
@ -91,89 +94,90 @@ builder.
- `subregion_name` (string) - Destination subregion to launch VM in. Leave this empty to allow Outscale to auto-assign.
- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
- `disable_stop_vm` (boolean) - Packer normally stops the build
VM after all provisioners have run. For Windows VMs, it is
sometimes desirable to [run Sysprep](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)) which will stop the VM for you. If this is set to `true`, Packer
*will not* stop the VM but will assume that you will send the stop
signal yourself through your final provisioner. You can do this with a
[windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html).
VM after all provisioners have run. For Windows VMs, it is
sometimes desirable to [run Sysprep](<https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)>) which will stop the VM for you. If this is set to `true`, Packer
_will not_ stop the VM but will assume that you will send the stop
signal yourself through your final provisioner. You can do this with a
[windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html).
Note that Packer will still wait for the VM to be stopped, and
failing to send the stop signal yourself, when you have set this flag to
`true`, will cause a timeout.
Note that Packer will still wait for the VM to be stopped, and
failing to send the stop signal yourself, when you have set this flag to
`true`, will cause a timeout.
- `bsu_optimized` (boolean) - If true, the VM is created with optimized BSU I/O.
- `force_delete_snapshot` (boolean) - Force Packer to delete snapshots
associated with OMIs, which have been deregistered by `force_deregister`.
Default `false`.
associated with OMIs, which have been deregistered by `force_deregister`.
Default `false`.
- `force_deregister` (boolean) - Force Packer to first deregister an existing
OMIS if one with the same name already exists. Default `false`.
OMIS if one with the same name already exists. Default `false`.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the OAPI endpoint. The default is `false`.
verification of the OAPI endpoint. The default is `false`.
- `launch_block_device_mappings` (array of block device mappings) - Add one
or more block devices before the Packer build starts. If you add VM
store volumes or BSU volumes in addition to the root device volume, the
created OMIS will contain block device mapping information for those
volumes. Outscale creates snapshots of the source VM's root volume and
any other BSU volumes described here. When you launch an VM from this
new OMI, the VM automatically launches with these additional volumes,
and will restore them from snapshots taken from the source VM.
or more block devices before the Packer build starts. If you add VM
store volumes or BSU volumes in addition to the root device volume, the
created OMIS will contain block device mapping information for those
volumes. Outscale creates snapshots of the source VM's root volume and
any other BSU volumes described here. When you launch an VM from this
new OMI, the VM automatically launches with these additional volumes,
and will restore them from snapshots taken from the source VM.
- `run_tags` (object of key/value strings) - Tags to apply to the VM
that is *launched* to create the OMI. These tags are *not* applied to the
resulting OMIS unless they're duplicated in `tags`. This is a [template
engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
that is _launched_ to create the OMI. These tags are _not_ applied to the
resulting OMIS unless they're duplicated in `tags`. This is a [template
engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `run_volume_tags` (object of key/value strings) - Tags to apply to the
volumes that are *launched* to create the OMI. These tags are *not* applied
to the resulting OMIS unless they're duplicated in `tags`. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
volumes that are _launched_ to create the OMI. These tags are _not_ applied
to the resulting OMIS unless they're duplicated in `tags`. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `security_group_id` (string) - The ID (*not* the name) of the security
group to assign to the VM. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access.
Note that if this is specified, you must be sure the security group allows
access to the `ssh_port` given below.
- `security_group_id` (string) - The ID (_not_ the name) of the security
group to assign to the VM. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access.
Note that if this is specified, you must be sure the security group allows
access to the `ssh_port` given below.
- `security_group_ids` (array of strings) - A list of security groups as
described above. Note that if this is specified, you must omit the
`security_group_id`.
described above. Note that if this is specified, you must omit the
`security_group_id`.
- `shutdown_behavior` (string) - Automatically terminate VMs on
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.
- `skip_region_validation` (boolean) - Set to true if you want to skip
validation of the region configuration option. Default `false`.
validation of the region configuration option. Default `false`.
- `snapshot_groups` (array of strings) - A list of groups that have access to
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
- `snapshot_users` (array of strings) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
- `snapshot_tags` (object of key/value strings) - Tags to apply to snapshot.
They will override OMIS tags if already applied to snapshot. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
They will override OMIS tags if already applied to snapshot. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `source_omi_filter` (object) - Filters used to populate the `source_omi` field.
- `filters` (map of strings) - filters used to select a `source_omi`.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
Example:
```json
@ -184,13 +188,13 @@ builder.
"image-name": "image-name-in-account",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"owners": ["099720109477"]
}
}
```
This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE:
This will fail unless *exactly* one OMIS is returned. In the above example,
This will fail unless _exactly_ one OMIS is returned. In the above example,
`most_recent` will cause this to succeed by selecting the newest image.
- `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the machine. The key must match a key pair name loaded up into Outscale. By default, this is blank, and Packer will generate a temporary keypair unless [`ssh_password`](../templates/communicator.html#ssh_password) is used. [`ssh_private_key_file`](../templates/communicator.html#ssh_private_key_file) or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized.
@ -216,22 +220,22 @@ builder.
- `net_id` (string) - If launching into a Net subnet, Packer needs the Net ID in order to create a temporary security group within the Net. Requires `subnet_id` to be set. If this field is left blank, Packer will try to get the Net ID from the `subnet_id`.
- `net_filter` (object) - Filters used to populate the `net_id` field.
Example:
Example:
```json
{
"net_filter": {
"filters": {
"is-default": "false",
"ip-range": "/24"
}
```json
{
"net_filter": {
"filters": {
"is-default": "false",
"ip-range": "/24"
}
}
```
}
```
This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless *exactly* one Net is returned.
This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless _exactly_ one Net is returned.
- `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless *exactly* one Net is returned.
- `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless _exactly_ one Net is returned.
`net_id` take precedence over this.

View File

@ -1,7 +1,7 @@
---
description: |
The osc-bsusurrogate Packer builder is like the chroot builder, but does not
require running inside an Outscale virtual machine.
The osc-bsusurrogate Packer builder is like the chroot builder, but does not
require running inside an Outscale virtual machine.
layout: docs
page_title: 'Outscale BSU Surrogate - Builders'
sidebar_current: 'docs-builders-osc-bsusurrogate'
@ -48,12 +48,12 @@ builder.
- `source_omi` (string) - The initial OMI used as a base for the newly created machine. `source_omi_filter` may be used instead to populate this automatically.
- `omi_root_device` (block device mapping) - A block device mapping
describing the root device of the OMI. This looks like the mappings in
`omi_block_device_mapping`, except with an additional field:
describing the root device of the OMI. This looks like the mappings in
`omi_block_device_mapping`, except with an additional field:
- `source_device_name` (string) - The device name of the block device on
the source virtual machine to be used as the root device for the OMI. This
must correspond to a block device in `launch_block_device_mapping`.
the source virtual machine to be used as the root device for the OMI. This
must correspond to a block device in `launch_block_device_mapping`.
### Optional:
@ -64,11 +64,11 @@ builder.
- `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping.
- `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information.
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information.
- `no_device` (boolean) - Suppresses the specified device included in the
block device mapping of the OMI.
block device mapping of the OMI.
- `snapshot_id` (string) - The ID of the snapshot
@ -79,7 +79,7 @@ builder.
- `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes
- `omi_description` (string) - The description to set for the resulting OMI(s). By default this description is empty. This is a [template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
data](#build-template-data) for more information.
- `omi_account_ids` (array of strings) - A list of account IDs that have access to launch the resulting OMI(s). By default no additional users other than the user creating the OMIS has permissions to launch it.
@ -90,40 +90,40 @@ builder.
- `subregion_name` (string) - Destination subregion to launch VM in. Leave this empty to allow Outscale to auto-assign.
- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
- `disable_stop_vm` (boolean) - Packer normally stops the build
VM after all provisioners have run. For Windows VMs, it is
sometimes desirable to [run Sysprep](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)) which will stop the VM for you. If this is set to `true`, Packer
*will not* stop the VM but will assume that you will send the stop
signal yourself through your final provisioner. You can do this with a
[windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html).
VM after all provisioners have run. For Windows VMs, it is
sometimes desirable to [run Sysprep](<https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)>) which will stop the VM for you. If this is set to `true`, Packer
_will not_ stop the VM but will assume that you will send the stop
signal yourself through your final provisioner. You can do this with a
[windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html).
Note that Packer will still wait for the VM to be stopped, and
failing to send the stop signal yourself, when you have set this flag to
`true`, will cause a timeout.
Note that Packer will still wait for the VM to be stopped, and
failing to send the stop signal yourself, when you have set this flag to
`true`, will cause a timeout.
- `bsu_optimized` (boolean) - If true, the VM is created with optimized BSU I/O.
- `force_deregister` (boolean) - Force Packer to first deregister an existing
OMI if one with the same name already exists. Default `false`.
OMI if one with the same name already exists. Default `false`.
- `force_delete_snapshot` (boolean) - Force Packer to delete snapshots
associated with OMIs, which have been deregistered by `force_deregister`.
Default `false`.
associated with OMIs, which have been deregistered by `force_deregister`.
Default `false`.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the OAPI endpoint. The default is `false`.
verification of the OAPI endpoint. The default is `false`.
- `launch_block_device_mappings` (array of block device mappings) - Add one
or more block devices before the Packer build starts. If you add VM
store volumes or BSU volumes in addition to the root device volume, the
created OMIS will contain block device mapping information for those
volumes. Outscale creates snapshots of the source VM's root volume and
any other BSU volumes described here. When you launch an VM from this
new OMI, the VM automatically launches with these additional volumes,
and will restore them from snapshots taken from the source VM.
or more block devices before the Packer build starts. If you add VM
store volumes or BSU volumes in addition to the root device volume, the
created OMIS will contain block device mapping information for those
volumes. Outscale creates snapshots of the source VM's root volume and
any other BSU volumes described here. When you launch an VM from this
new OMI, the VM automatically launches with these additional volumes,
and will restore them from snapshots taken from the source VM.
- `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build.
@ -138,53 +138,54 @@ builder.
- `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes
- `run_tags` (object of key/value strings) - Tags to apply to the VM
that is *launched* to create the OMI. These tags are *not* applied to the
resulting OMIS unless they're duplicated in `tags`. This is a [template
engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
that is _launched_ to create the OMI. These tags are _not_ applied to the
resulting OMIS unless they're duplicated in `tags`. This is a [template
engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `run_volume_tags` (object of key/value strings) - Tags to apply to the
volumes that are *launched* to create the OMI. These tags are *not* applied
to the resulting OMIS unless they're duplicated in `tags`. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
volumes that are _launched_ to create the OMI. These tags are _not_ applied
to the resulting OMIS unless they're duplicated in `tags`. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `security_group_id` (string) - The ID (*not* the name) of the security
group to assign to the VM. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access.
Note that if this is specified, you must be sure the security group allows
access to the `ssh_port` given below.
- `security_group_id` (string) - The ID (_not_ the name) of the security
group to assign to the VM. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access.
Note that if this is specified, you must be sure the security group allows
access to the `ssh_port` given below.
- `security_group_ids` (array of strings) - A list of security groups as
described above. Note that if this is specified, you must omit the
`security_group_id`.
described above. Note that if this is specified, you must omit the
`security_group_id`.
- `shutdown_behavior` (string) - Automatically terminate VMs on
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.
- `skip_region_validation` (boolean) - Set to true if you want to skip
validation of the region configuration option. Default `false`.
validation of the region configuration option. Default `false`.
- `snapshot_groups` (array of strings) - A list of groups that have access to
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
- `snapshot_users` (array of strings) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
- `snapshot_tags` (object of key/value strings) - Tags to apply to snapshot.
They will override OMIS tags if already applied to snapshot. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
They will override OMIS tags if already applied to snapshot. This is a
[template engine](../templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `source_omi_filter` (object) - Filters used to populate the `source_omi` field.
- `filters` (map of strings) - filters used to select a `source_omi`.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
Example:
```json
@ -195,13 +196,13 @@ builder.
"image-name": "image-name",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"owners": ["099720109477"]
}
}
```
This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE:
This will fail unless *exactly* one OMIS is returned. In the above example,
This will fail unless _exactly_ one OMIS is returned. In the above example,
`most_recent` will cause this to succeed by selecting the newest image.
- `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the machine. The key must match a key pair name loaded up into Outscale. By default, this is blank, and Packer will generate a temporary keypair unless [`ssh_password`](../templates/communicator.html#ssh_password) is used. [`ssh_private_key_file`](../templates/communicator.html#ssh_private_key_file) or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized.
@ -227,22 +228,22 @@ builder.
- `net_id` (string) - If launching into a Net subnet, Packer needs the Net ID in order to create a temporary security group within the Net. Requires `subnet_id` to be set. If this field is left blank, Packer will try to get the Net ID from the `subnet_id`.
- `net_filter` (object) - Filters used to populate the `net_id` field.
Example:
Example:
```json
{
"net_filter": {
"filters": {
"is-default": "false",
"ip-range": "/24"
}
```json
{
"net_filter": {
"filters": {
"is-default": "false",
"ip-range": "/24"
}
}
```
}
```
This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless *exactly* one Net is returned.
This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless _exactly_ one Net is returned.
- `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless *exactly* one Net is returned.
- `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless _exactly_ one Net is returned.
`net_id` take precedence over this.
@ -252,30 +253,30 @@ builder.
```json
{
"type" : "osc-bsusurrogate",
"secret_key" : "YOUR SECRET KEY HERE",
"access_key" : "YOUR KEY HERE",
"region" : "eu-west-2",
"ssh_username" : "outscale",
"vm_type" : "t2.medium",
"source_omi" : "ami-bcfc34e0",
"subregion_name": "eu-west-2a",
"launch_block_device_mappings" : [
{
"volume_type" : "io1",
"device_name" : "/dev/xvdf",
"delete_on_vm_deletion" : false,
"volume_size" : 10,
"iops": 300
}
],
"omi_root_device":{
"source_device_name": "/dev/xvdf",
"device_name": "/dev/sda1",
"delete_on_vm_deletion": true,
"volume_size": 10,
"volume_type": "standard"
"type": "osc-bsusurrogate",
"secret_key": "YOUR SECRET KEY HERE",
"access_key": "YOUR KEY HERE",
"region": "eu-west-2",
"ssh_username": "outscale",
"vm_type": "t2.medium",
"source_omi": "ami-bcfc34e0",
"subregion_name": "eu-west-2a",
"launch_block_device_mappings": [
{
"volume_type": "io1",
"device_name": "/dev/xvdf",
"delete_on_vm_deletion": false,
"volume_size": 10,
"iops": 300
}
],
"omi_root_device": {
"source_device_name": "/dev/xvdf",
"device_name": "/dev/sda1",
"delete_on_vm_deletion": true,
"volume_size": 10,
"volume_type": "standard"
}
}
```

View File

@ -1,7 +1,7 @@
---
description: |
The osc-bsuvolume Packer builder is like the BSU builder, but is intended to
create BSU volumes rather than a machine image.
The osc-bsuvolume Packer builder is like the BSU builder, but is intended to
create BSU volumes rather than a machine image.
layout: docs
page_title: 'Outscale BSU Volume - Builders'
sidebar_current: 'docs-builders-osc-bsuvolume'
@ -11,8 +11,8 @@ sidebar_current: 'docs-builders-osc-bsuvolume'
Type: `osc-bsuvolume`
The `osc-bsuvolume` Packer builder is able to create Outscale Block Stogate Unit
volumes which are prepopulated with filesystems or data.
The `osc-bsuvolume` Packer builder is able to create Ouscale Block Stogate Unit
volumes which are prepopulated with filesystems or data.
This builder builds BSU volumes by launching an Outscale VM from a source OMI,
provisioning that running machine, and then destroying the source machine,
@ -22,7 +22,7 @@ This is all done in your own Outscale account. The builder will create temporary
pairs, security group rules, etc. that provide it temporary access to the
instance while the image is being created.
The builder does *not* manage BSU Volumes. Once it creates volumes and stores
The builder does _not_ manage BSU Volumes. Once it creates volumes and stores
it in your account, it is up to you to use, delete, etc. the volumes.
-&gt; **Note:** Temporary resources are, by default, all created with the
@ -54,14 +54,14 @@ builder.
### Optional:
- `ebs_volumes` (array of block device mappings) - Add the block device
mappings to the OMI. The block device mappings allow for keys:
mappings to the OMI. The block device mappings allow for keys:
- `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping.
- `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on instance termination.
- `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information.
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information.
- `no_device` (boolean) - Suppresses the specified device included in the block device mapping of the OMI.
@ -74,72 +74,73 @@ builder.
- `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes
- `tags` (map) - Tags to apply to the volume. These are retained after
the builder completes. This is a [template
engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
the builder completes. This is a [template
engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `associate_public_ip_address` (boolean) - If using a non-default Net, public IP addresses are not provided by default. If this is toggled, your new VM will get a Public IP.
- `subregion_name` (string) - Destination subregion to launch VM in. Leave this empty to allow Outscale to auto-assign.
- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
- `disable_stop_vm` (boolean) - Packer normally stops the build
VM after all provisioners have run. For Windows VMs, it is
sometimes desirable to [run Sysprep](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)) which will stop the VM for you. If this is set to `true`, Packer
*will not* stop the VM but will assume that you will send the stop
signal yourself through your final provisioner. You can do this with a
[windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html).
VM after all provisioners have run. For Windows VMs, it is
sometimes desirable to [run Sysprep](<https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc721940(v=ws.10)>) which will stop the VM for you. If this is set to `true`, Packer
_will not_ stop the VM but will assume that you will send the stop
signal yourself through your final provisioner. You can do this with a
[windows-shell provisioner](https://www.packer.io/docs/provisioners/windows-shell.html).
Note that Packer will still wait for the VM to be stopped, and
failing to send the stop signal yourself, when you have set this flag to
`true`, will cause a timeout.
Note that Packer will still wait for the VM to be stopped, and
failing to send the stop signal yourself, when you have set this flag to
`true`, will cause a timeout.
- `bsu_optimized` (boolean) - If true, the VM is created with optimized BSU I/O.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the OAPI endpoint. The default is `false`.
verification of the OAPI endpoint. The default is `false`.
- `run_tags` (object of key/value strings) - Tags to apply to the instance
that is *launched* to create the OMI. These tags are *not* applied to the
resulting OMI unless they're duplicated in `tags`. This is a [template
engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
that is _launched_ to create the OMI. These tags are _not_ applied to the
resulting OMI unless they're duplicated in `tags`. This is a [template
engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `security_group_id` (string) - The ID (*not* the name) of the security
group to assign to the VM. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access.
Note that if this is specified, you must be sure the security group allows
access to the `ssh_port` given below.
- `security_group_id` (string) - The ID (_not_ the name) of the security
group to assign to the VM. By default this is not set and Packer will
automatically create a new temporary security group to allow SSH access.
Note that if this is specified, you must be sure the security group allows
access to the `ssh_port` given below.
- `security_group_ids` (array of strings) - A list of security groups as
described above. Note that if this is specified, you must omit the
`security_group_id`.
described above. Note that if this is specified, you must omit the
`security_group_id`.
- `shutdown_behavior` (string) - Automatically terminate instances on
shutdown in case Packer exits ungracefully. Possible values are `stop` and
`terminate`. Defaults to `stop`.
- `shutdown_behavior` (string) - Automatically terminate instances on
shutdown in case Packer exits ungracefully. Possible values are `stop` and
`terminate`. Defaults to `stop`.
- `shutdown_behavior` (string) - Automatically terminate VMs on
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.
- `snapshot_groups` (array of strings) - A list of groups that have access to
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
- `snapshot_users` (array of strings) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMI has permissions to create
volumes from the backing snapshot(s).
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
- `source_omi_filter` (object) - Filters used to populate the `source_omi` field.
- `filters` (map of strings) - filters used to select a `source_omi`.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
Example:
```json
@ -150,13 +151,13 @@ builder.
"image-name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"owners": ["099720109477"]
}
}
```
This selects an Ubuntu 16.04 HVM BSU OMI from Canonical. NOTE:
This will fail unless *exactly* one OMI is returned. In the above example,
This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE:
This will fail unless _exactly_ one OMIS is returned. In the above example,
`most_recent` will cause this to succeed by selecting the newest image.
- `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the machine. The key must match a key pair name loaded up into Outscale. By default, this is blank, and Packer will generate a temporary keypair unless [`ssh_password`](../templates/communicator.html#ssh_password) is used. [`ssh_private_key_file`](../templates/communicator.html#ssh_private_key_file) or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized.
@ -178,22 +179,22 @@ builder.
- `net_id` (string) - If launching into a Net subnet, Packer needs the Net ID in order to create a temporary security group within the Net. Requires `subnet_id` to be set. If this field is left blank, Packer will try to get the Net ID from the `subnet_id`.
- `net_filter` (object) - Filters used to populate the `net_id` field.
Example:
Example:
```json
{
"net_filter": {
"filters": {
"is-default": "false",
"ip-range": "/24"
}
```json
{
"net_filter": {
"filters": {
"is-default": "false",
"ip-range": "/24"
}
}
```
}
```
This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless *exactly* one Net is returned.
This selects the Net with a IPv4 CIDR block of `/24`. NOTE: This will fail unless _exactly_ one Net is returned.
- `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless *exactly* one Net is returned.
- `filters` (map of strings) - filters used to select a `vpc_id`. NOTE: This will fail unless _exactly_ one Net is returned.
`net_id` take precedence over this.
@ -203,47 +204,47 @@ builder.
```json
{
"builders": [
"builders": [
{
"type": "osc-bsuvolume",
"region": "eu-west-2",
"vm_type": "t2.micro",
"source_omi": "ami-65efcc11",
"ssh_username": "outscale",
"ebs_volumes": [
{
"type": "osc-bsuvolume",
"region": "eu-west-2",
"vm_type": "t2.micro",
"source_omi": "ami-65efcc11",
"ssh_username": "outscale",
"ebs_volumes": [
{
"volume_type": "gp2",
"device_name": "/dev/xvdf",
"delete_on_vm_deletion": false,
"tags": {
"zpool": "data",
"Name": "Data1"
},
"volume_size": 10
},
{
"volume_type": "gp2",
"device_name": "/dev/xvdg",
"tags": {
"zpool": "data",
"Name": "Data2"
},
"delete_on_vm_deletion": false,
"volume_size": 10
},
{
"volume_size": 10,
"tags": {
"Name": "Data3",
"zpool": "data"
},
"delete_on_vm_deletion": false,
"device_name": "/dev/xvdh",
"volume_type": "gp2"
}
]
"volume_type": "gp2",
"device_name": "/dev/xvdf",
"delete_on_vm_deletion": false,
"tags": {
"zpool": "data",
"Name": "Data1"
},
"volume_size": 10
},
{
"volume_type": "gp2",
"device_name": "/dev/xvdg",
"tags": {
"zpool": "data",
"Name": "Data2"
},
"delete_on_vm_deletion": false,
"volume_size": 10
},
{
"volume_size": 10,
"tags": {
"Name": "Data3",
"zpool": "data"
},
"delete_on_vm_deletion": false,
"device_name": "/dev/xvdh",
"volume_type": "gp2"
}
]
]
}
]
}
```
@ -267,12 +268,12 @@ In configuration directives marked as a template engine above, the following
variables are available:
- `BuildRegion` - The region (for example `eu-west-2`) where Packer is
building the OMI.
building the OMI.
- `SourceOMI` - The source OMI ID (for example `ami-a2412fcd`) used to build
the OMI.
the OMI.
- `SourceOMIName` - The source OMI Name (for example
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the OMI.
`ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306`) used to
build the OMI.
- `SourceOMITags` - The source OMI Tags, as a `map[string]string` object.
-&gt; **Note:** Packer uses pre-built OMIs as the source for building images.

View File

@ -1,12 +1,16 @@
---
description: |
The amazon-chroot Packer builder is able to create Outscale OMIs backed by an BSU
volume as the root device. For more information on the difference between
instance storage and BSU-backed instances, storage for the root device section
in the Outscale documentation.
description: >
The amazon-chroot Packer builder is able to create Outscale OMIs backed by an
BSU
volume as the root device. For more information on the difference between
instance storage and BSU-backed instances, storage for the root device section
in the Outscale documentation.
layout: docs
page_title: 'Outscale chroot - Builders'
sidebar_current: 'docs-builders-osc-chroot'
page_title: Outscale chroot - Builders
sidebar_current: docs-builders-osc-chroot
---
# OMI Builder (chroot)
@ -28,7 +32,7 @@ the extra fast build.
Packer, we recommend starting with the [osc-bsu
builder](/docs/builders/osc-bsu.html), which is much easier to use.
The builder does *not* manage OMIs. Once it creates an OMI and stores it in
The builder does _not_ manage OMIs. Once it creates an OMI and stores it in
your account, it is up to you to use, delete, etc., the OMI.
## How Does it Work?
@ -68,67 +72,67 @@ each category, the available configuration keys are alphabetized.
### Optional:
- `omi_description` (string) - The description to set for the resulting OMI(s).
By default this description is empty. This is a [template engine](../templates/engine.html),
see [Build template data](#build-template-data) for more information.
By default this description is empty. This is a [template engine](../templates/engine.html),
see [Build template data](#build-template-data) for more information.
- `omi_account_ids` (array of strings) - A list of account IDs that have access to launch the resulting OMI(s). By default no additional users other than the user creating the OMIS has permissions to launch it.
- `omi_virtualization_type` (string) - The type of virtualization for the OMI you are building. This option must match the supported virtualization type of `source_omi`. Can be `paravirtual` or `hvm`.
- `chroot_mounts` (array of array of strings) - This is a list of devices to
mount into the chroot environment. This configuration parameter requires
some additional documentation which is in the [Chroot
Mounts](#chroot-mounts) section. Please read that section for more
information on how to use this.
mount into the chroot environment. This configuration parameter requires
some additional documentation which is in the [Chroot
Mounts](#chroot-mounts) section. Please read that section for more
information on how to use this.
- `command_wrapper` (string) - How to run shell commands. This defaults to
`{{.Command}}`. This may be useful to set if you want to set environmental
variables or perhaps run it with `sudo` or so on. This is a configuration
template where the `.Command` variable is replaced with the command to be
run. Defaults to `{{.Command}}`.
`{{.Command}}`. This may be useful to set if you want to set environmental
variables or perhaps run it with `sudo` or so on. This is a configuration
template where the `.Command` variable is replaced with the command to be
run. Defaults to `{{.Command}}`.
- `copy_files` (array of strings) - Paths to files on the running Outscale
VM that will be copied into the chroot environment prior to
provisioning. Defaults to `/etc/resolv.conf` so that DNS lookups work. Pass
an empty list to skip copying `/etc/resolv.conf`. You may need to do this
if you're building an image that uses systemd.
VM that will be copied into the chroot environment prior to
provisioning. Defaults to `/etc/resolv.conf` so that DNS lookups work. Pass
an empty list to skip copying `/etc/resolv.conf`. You may need to do this
if you're building an image that uses systemd.
- `custom_endpoint_oapi` (string) - This option is useful if you use a cloud
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
provider whose API is compatible with Outscale OAPI. Specify another endpoint
like this `outscale.com/oapi/latest`.
- `device_path` (string) - The path to the device where the root volume of
the source OMI will be attached. This defaults to "" (empty string), which
forces Packer to find an open device automatically.
the source OMI will be attached. This defaults to "" (empty string), which
forces Packer to find an open device automatically.
- `force_deregister` (boolean) - Force Packer to first deregister an existing
OMIS if one with the same name already exists. Default `false`.
OMIS if one with the same name already exists. Default `false`.
- `force_delete_snapshot` (boolean) - Force Packer to delete snapshots
associated with OMIs, which have been deregistered by `force_deregister`.
Default `false`.
associated with OMIs, which have been deregistered by `force_deregister`.
Default `false`.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the OAPI endpoint. The default is `false`.
verification of the OAPI endpoint. The default is `false`.
- `from_scratch` (boolean) - Build a new volume instead of starting from an
existing OMI root volume snapshot. Default `false`. If `true`, `source_omi`
is no longer used and the following options become required:
`omi_virtualization_type`, `pre_mount_commands` and `root_volume_size`. The
below options are also required in this mode only:
existing OMI root volume snapshot. Default `false`. If `true`, `source_omi`
is no longer used and the following options become required:
`omi_virtualization_type`, `pre_mount_commands` and `root_volume_size`. The
below options are also required in this mode only:
- `omi_block_device_mappings` (array of block device mappings) - Add one or more [block device mappings](https://wiki.outscale.net/display/EN/Defining+Block+Device+Mappings) to the OMI. These will be attached when booting a new VM from your OMI. To add a block device during the Packer build see `launch_block_device_mappings` below. Your options here may vary depending on the type of VM you use. The block device mappings allow for the following configuration:
- `delete_on_vm_deletion` (boolean) - Indicates whether the BSU volume is deleted on VM termination. Default `false`. **NOTE**: If this value is not explicitly set to `true` and volumes are not cleaned up by an alternative method, additional volumes will accumulate after every build.
- `device_name` (string) - The device name exposed to the VM (for example, `/dev/sdh` or `xvdh`). Required for every device in the block device mapping.
- `iops` (number) - The number of I/O operations per second (IOPS) that the volume supports. See the documentation on
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information
[IOPs](https://wiki.outscale.net/display/EN/About+Volumes#AboutVolumes-VolumeTypesVolumeTypesandIOPS)
for more information
- `no_device` (boolean) - Suppresses the specified device included in the
block device mapping of the OMI
block device mapping of the OMI
- `snapshot_id` (string) - The ID of the snapshot
@ -141,80 +145,81 @@ each category, the available configuration keys are alphabetized.
- `root_device_name` (string) - The root device name. For example, `xvda`.
- `mount_path` (string) - The path where the volume will be mounted. This is
where the chroot environment will be. This defaults to
`/mnt/packer-amazon-chroot-volumes/{{.Device}}`. This is a configuration
template where the `.Device` variable is replaced with the name of the
device where the volume is attached.
where the chroot environment will be. This defaults to
`/mnt/packer-amazon-chroot-volumes/{{.Device}}`. This is a configuration
template where the `.Device` variable is replaced with the name of the
device where the volume is attached.
- `mount_partition` (string) - The partition number containing the /
partition. By default this is the first partition of the volume, (for
example, `xvdf1`) but you can designate the entire block device by setting
`"mount_partition": "0"` in your config, which will mount `xvdf` instead.
partition. By default this is the first partition of the volume, (for
example, `xvdf1`) but you can designate the entire block device by setting
`"mount_partition": "0"` in your config, which will mount `xvdf` instead.
- `mount_options` (array of strings) - Options to supply the `mount` command
when mounting devices. Each option will be prefixed with `-o` and supplied
to the `mount` command ran by Packer. Because this command is ran in a
shell, user discretion is advised. See [this manual page for the mount
command](http://linuxcommand.org/man_pages/mount8.html) for valid file
system specific options.
when mounting devices. Each option will be prefixed with `-o` and supplied
to the `mount` command ran by Packer. Because this command is ran in a
shell, user discretion is advised. See [this manual page for the mount
command](http://linuxcommand.org/man_pages/mount8.html) for valid file
system specific options.
- `nvme_device_path` (string) - When we call the mount command (by default
`mount -o device dir`), the string provided in `nvme_mount_path` will
replace `device` in that command. When this option is not set, `device` in
that command will be something like `/dev/sdf1`, mirroring the attached
device name. This assumption works for most instances but will fail with c5
and m5 instances. In order to use the chroot builder with c5 and m5
instances, you must manually set `nvme_device_path` and `device_path`.
`mount -o device dir`), the string provided in `nvme_mount_path` will
replace `device` in that command. When this option is not set, `device` in
that command will be something like `/dev/sdf1`, mirroring the attached
device name. This assumption works for most instances but will fail with c5
and m5 instances. In order to use the chroot builder with c5 and m5
instances, you must manually set `nvme_device_path` and `device_path`.
- `pre_mount_commands` (array of strings) - A series of commands to execute
after attaching the root volume and before mounting the chroot. This is not
required unless using `from_scratch`. If so, this should include any
partitioning and filesystem creation commands. The path to the device is
provided by `{{.Device}}`.
after attaching the root volume and before mounting the chroot. This is not
required unless using `from_scratch`. If so, this should include any
partitioning and filesystem creation commands. The path to the device is
provided by `{{.Device}}`.
- `post_mount_commands` (array of strings) - As `pre_mount_commands`, but the
commands are executed after mounting the root device and before the extra
mount and copy steps. The device and mount path are provided by
`{{.Device}}` and `{{.MountPath}}`.
commands are executed after mounting the root device and before the extra
mount and copy steps. The device and mount path are provided by
`{{.Device}}` and `{{.MountPath}}`.
- `root_volume_size` (number) - The size of the root volume in GB for the
chroot environment and the resulting OMI. Default size is the snapshot size
of the `source_omi` unless `from_scratch` is `true`, in which case this
field must be defined.
chroot environment and the resulting OMI. Default size is the snapshot size
of the `source_omi` unless `from_scratch` is `true`, in which case this
field must be defined.
- `root_volume_type` (string) - The type of BSU volume for the chroot
environment and resulting OMI. The default value is the type of the
`source_omi`, unless `from_scratch` is `true`, in which case the default
value is `gp2`. You can only specify `io1` if building based on top of a
`source_omi` which is also `io1`.
environment and resulting OMI. The default value is the type of the
`source_omi`, unless `from_scratch` is `true`, in which case the default
value is `gp2`. You can only specify `io1` if building based on top of a
`source_omi` which is also `io1`.
- `root_volume_tags` (object of key/value strings) - Tags to apply to the
volumes that are *launched*. This is a [template
engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
volumes that are _launched_. This is a [template
engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `skip_region_validation` (boolean) - Set to true if you want to skip
validation of the region configuration option. Default `false`.
validation of the region configuration option. Default `false`.
- `snapshot_tags` (object of key/value strings) - Tags to apply to snapshot.
They will override OMI tags if already applied to snapshot. This is a
[template engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
They will override OMI tags if already applied to snapshot. This is a
[template engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
- `snapshot_groups` (array of strings) - A list of groups that have access to
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
create volumes from the snapshot(s). By default no groups have permission
to create volumes from the snapshot(s). `all` will make the snapshot
publicly accessible.
- `snapshot_users` (array of strings) - A list of account IDs that have
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
access to create volumes from the snapshot(s). By default no additional
users other than the user creating the OMIS has permissions to create
volumes from the backing snapshot(s).
- `source_omi_filter` (object) - Filters used to populate the `source_omi` field.
- `filters` (map of strings) - filters used to select a `source_omi`.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
- `owners` (array of strings) - Filters the images by their owner. You may specify one or more Outscale account IDs, "self" (which will use the account whose credentials you are using to run Packer). This option is required for security reasons.
Example:
```json
@ -225,13 +230,13 @@ each category, the available configuration keys are alphabetized.
"image-name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"owners": ["099720109477"]
}
}
```
This selects an Ubuntu 16.04 HVM BSU OMIS from Canonical. NOTE:
This will fail unless *exactly* one OMIS is returned. In the above example,
This will fail unless _exactly_ one OMIS is returned. In the above example,
`most_recent` will cause this to succeed by selecting the newest image.
You may set this in place of `source_omi` or in conjunction with it. If you
@ -241,8 +246,8 @@ each category, the available configuration keys are alphabetized.
filter, but will cause Packer to fail if the `source_omi` does not exist.
- `tags` (object of key/value strings) - Tags applied to the OMI. This is a
[template engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
[template engine](/docs/templates/engine.html), see [Build template
data](#build-template-data) for more information.
## Basic Example
@ -268,7 +273,7 @@ chroot by Packer:
- `/sys` (sysfs)
- `/dev` (bind to real `/dev`)
- `/dev/pts` (devpts)
- `/proc/sys/fs/binfmt_misc` (binfmt\_misc)
- `/proc/sys/fs/binfmt_misc` (binfmt_misc)
These default mounts are usually good enough for anyone and are sane defaults.
However, if you want to change or add the mount points, you may using the
@ -296,7 +301,7 @@ mounts `/proc` and `/dev`:
## Parallelism
A quick note on parallelism: it is perfectly safe to run multiple *separate*
A quick note on parallelism: it is perfectly safe to run multiple _separate_
Packer processes with the `osc-chroot` builder on the same Outscale VM. In
fact, this is recommended as a way to push the most performance out of your OMI
builds.
@ -318,7 +323,7 @@ file which will prevent packages installed by your provisioners from starting
services:
```json
{
({
"type": "shell",
"inline": [
"echo '#!/bin/sh' > /usr/sbin/policy-rc.d",
@ -326,15 +331,12 @@ services:
"chmod a+x /usr/sbin/policy-rc.d"
]
},
// ...
{
"type": "shell",
"inline": [
"rm -f /usr/sbin/policy-rc.d"
]
}
"inline": ["rm -f /usr/sbin/policy-rc.d"]
})
```
### Ansible provisioner

View File

@ -1,10 +1,12 @@
---
description: |
Packer is able to create Outscale Machine Images (OMIs). To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the OMI.
description: >
Packer is able to create Outscale Machine Images (OMIs). To achieve this,
Packer comes with
multiple builders depending on the strategy you want to use to build the OMI.
layout: docs
page_title: 'Outscale OMI - Builders'
sidebar_current: 'docs-builders-osc'
page_title: Outscale OMI - Builders
sidebar_current: docs-builders-osc
---
# Outscale OMI Builder
@ -14,20 +16,20 @@ multiple builders depending on the strategy you want to use to build the OMI.
Packer supports the following builders at the moment:
- [osc-bsu](/docs/builders/osc-bsu.html) - Create BSU-backed OMIs by
launching a source OMI and re-packaging it into a new OMI after
provisioning. If in doubt, use this builder, which is the easiest to get
started with.
launching a source OMI and re-packaging it into a new OMI after
provisioning. If in doubt, use this builder, which is the easiest to get
started with.
- [osc-chroot](/docs/builders/osc-chroot.html) - Create EBS-backed OMIs
from an existing OUTSCALE VM by mounting the root device and using a
[Chroot](https://en.wikipedia.org/wiki/Chroot) environment to provision
that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed OMI
since no new OUTSCALE VM needs to be launched.
from an existing OUTSCALE VM by mounting the root device and using a
[Chroot](https://en.wikipedia.org/wiki/Chroot) environment to provision
that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed OMI
since no new OUTSCALE VM needs to be launched.
- [osc-bsusurrogate](/docs/builders/osc-bsusurrogate.html) - Create BSU-backed OMIs from scratch. Works similarly to the `chroot` builder but does
not require running in Outscale VM. This is an **advanced builder and should not be
used by newcomers**.
not require running in Outscale VM. This is an **advanced builder and should not be
used by newcomers**.
-&gt; **Don't know which builder to use?** If in doubt, use the [osc-bsu
builder](/docs/builders/osc-bsu.html). It is much easier to use and Outscale generally recommends BSU-backed images nowadays.
@ -54,11 +56,11 @@ These look like:
```json
{
"access_key": "AKIAIOSFODNN7EXAMPLE",
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"region": "us-east-1",
"type": "osc-bsu",
"oapi_custom_endpoint": "outscale.com/oapi/latest"
"access_key": "AKIAIOSFODNN7EXAMPLE",
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"region": "us-east-1",
"type": "osc-bsu",
"oapi_custom_endpoint": "outscale.com/oapi/latest"
}
```

View File

@ -0,0 +1,296 @@
---
modeline: |
vim: set ft=pandoc:
description: |
The Parallels Packer builder is able to create Parallels Desktop for Mac
virtual machines and export them in the PVM format, starting from an ISO
image.
layout: docs
page_title: Parallels ISO - Builders
sidebar_current: docs-builders-parallels-iso
---
# Parallels Builder (from an ISO)
Type: `parallels-iso`
The Parallels Packer builder is able to create [Parallels Desktop for
Mac](https://www.parallels.com/products/desktop/) virtual machines and export
them in the PVM format, starting from an ISO image.
The builder builds a virtual machine by creating a new virtual machine from
scratch, booting it, installing an OS, provisioning software within the OS, then
shutting it down. The result of the Parallels builder is a directory containing
all the files necessary to run the virtual machine portably.
## Basic Example
Here is a basic example. This example is not functional. It will start the OS
installer but then fail because we don't provide the preseed file for Ubuntu to
self-install. Still, the example serves to show the basic configuration:
```json
{
"type": "parallels-iso",
"guest_os_type": "ubuntu",
"iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.3-server-amd64.iso",
"iso_checksum": "2cbe868812a871242cdcdd8f2fd6feb9",
"parallels_tools_flavor": "lin",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_timeout": "30s",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
}
```
It is important to add a `shutdown_command`. By default Packer halts the virtual
machine and the file system may not be sync'd. Thus, changes made in a
provisioner might not be saved.
## Configuration Reference
There are many configuration options available for the Parallels builder. They
are organized below into two categories: required and optional. Within each
category, the available options are alphabetized and described.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
## ISO Configuration Reference
@include 'partials/common/ISOConfig.mdx'
### Required:
@include 'partials/common/ISOConfig-required.mdx'
### Optional:
@include 'partials/common/ISOConfig-not-required.mdx'
### Required:
- `parallels_tools_flavor` (string) - The flavor of the Parallels Tools ISO to
install into the VM. Valid values are "win", "lin", "mac", "os2"
and "other". This can be omitted only if `parallels_tools_mode`
is "disable".
### Optional:
- `boot_command` (array of strings) - This is an array of commands to type
when the virtual machine is first booted. The goal of these commands should
be to type just enough to initialize the operating system installer. Special
keys can be typed as well, and are covered in the section below on the
boot command. If this is not specified, it is assumed the installer will
start itself.
- `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be
a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
five seconds and one minute 30 seconds, respectively. If this isn't
specified, the default is 10 seconds.
- `cpus` (number) - The number of cpus to use for building the VM.
Defaults to `1`.
- `disk_size` (number) - The size, in megabytes, of the hard disk to create
for the VM. By default, this is 40000 (about 40 GB).
- `disk_type` (string) - The type for image file based virtual disk drives,
defaults to `expand`. Valid options are `expand` (expanding disk) that the
image file is small initially and grows in size as you add data to it, and
`plain` (plain disk) that the image file has a fixed size from the moment it
is created (i.e the space is allocated for the full drive). Plain disks
perform faster than expanding disks. `skip_compaction` will be set to true
automatically for plain disks.
- `floppy_files` (array of strings) - A list of files to place onto a floppy
disk that is attached when the VM is booted. This is most useful for
unattended Windows installs, which look for an `Autounattend.xml` file on
removable media. By default, no floppy will be attached. All files listed in
this setting get placed into the root directory of the floppy and the floppy
is attached as the first floppy device. Currently, no support exists for
creating sub-directories on the floppy. Wildcard characters (\*, ?,
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `floppy_dirs` (array of strings) - A list of directories to place onto
the floppy disk recursively. This is similar to the `floppy_files` option
except that the directory structure is preserved. This is useful for when
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `guest_os_type` (string) - The guest OS type being installed. By default
this is "other", but you can get _dramatic_ performance improvements by
setting this to the proper value. To view all available values for this run
`prlctl create x --distribution list`. Setting the correct value hints to
Parallels Desktop how to optimize the virtual hardware to work best with
that operating system.
- `hard_drive_interface` (string) - The type of controller that the hard
drives are attached to, defaults to "sata". Valid options are "sata", "ide",
and "scsi".
- `host_interfaces` (array of strings) - A list of which interfaces on the
host should be searched for a IP address. The first IP address found on one
of these will be used as `{{ .HTTPIP }}` in the `boot_command`. Defaults to
\["en0", "en1", "en2", "en3", "en4", "en5", "en6", "en7", "en8", "en9",
"ppp0", "ppp1", "ppp2"\].
- `http_directory` (string) - Path to a directory to serve using an
HTTP server. The files in this directory will be available over HTTP that
will be requestable from the virtual machine. This is useful for hosting
kickstart files and so on. By default this is "", which means no HTTP server
will be started. The address and port of the HTTP server will be available
as variables in `boot_command`. This is covered in more detail below.
- `http_port_min` and `http_port_max` (number) - These are the minimum and
maximum port to use for the HTTP server started to serve the
`http_directory`. Because Packer often runs in parallel, Packer will choose
a randomly available port in this range to run the HTTP server. If you want
to force the HTTP server to be on one port, make this minimum and maximum
port the same. By default the values are 8000 and 9000, respectively.
- `memory` (number) - The amount of memory to use for building the VM in
megabytes. Defaults to `512` megabytes.
- `output_directory` (string) - This is the path to the directory where the
resulting virtual machine will be created. This may be relative or absolute.
If relative, the path is relative to the working directory when `packer`
is executed. This directory must not exist or be empty prior to running
the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the
name of the build.
- `parallels_tools_guest_path` (string) - The path in the virtual machine to
upload Parallels Tools. This only takes effect if `parallels_tools_mode`
is "upload". This is a [configuration
template](/docs/templates/engine.html) that has a single
valid variable: `Flavor`, which will be the value of
`parallels_tools_flavor`. By default this is "prl-tools-{{.Flavor}}.iso"
which should upload into the login directory of the user.
- `parallels_tools_mode` (string) - The method by which Parallels Tools are
made available to the guest for installation. Valid options are "upload",
"attach", or "disable". If the mode is "attach" the Parallels Tools ISO will
be attached as a CD device to the virtual machine. If the mode is "upload"
the Parallels Tools ISO will be uploaded to the path specified by
`parallels_tools_guest_path`. The default value is "upload".
- `prlctl` (array of array of strings) - Custom `prlctl` commands to execute
in order to further customize the virtual machine being created. The value
of this is an array of commands to execute. The commands are executed in the
order defined in the template. For each command, the command is defined
itself as an array of strings, where each string represents a single
argument on the command-line to `prlctl` (but excluding `prlctl` itself).
Each arg is treated as a [configuration
template](/docs/templates/engine.html), where the `Name`
variable is replaced with the VM name. More details on how to use `prlctl`
are below.
- `prlctl_post` (array of array of strings) - Identical to `prlctl`, except
that it is run after the virtual machine is shutdown, and before the virtual
machine is exported.
- `prlctl_version_file` (string) - The path within the virtual machine to
upload a file that contains the `prlctl` version that was used to create
the machine. This information can be useful for provisioning. By default
this is ".prlctl_version", which will generally upload it into the
home directory.
- `shutdown_command` (string) - The command to use to gracefully shut down the
machine once all the provisioning is done. By default this is an empty
string, which tells Packer to just forcefully shut down the machine.
- `sound` (boolean) - Specifies whether to enable the sound device when
building the VM. Defaults to `false`.
- `shutdown_timeout` (string) - The amount of time to wait after executing the
`shutdown_command` for the virtual machine to actually shut down. If it
doesn't shut down in this time, it is an error. By default, the timeout is
"5m", or five minutes.
- `skip_compaction` (boolean) - Virtual disk image is compacted at the end of
the build process using `prl_disk_tool` utility (except for the case that
`disk_type` is set to `plain`). In certain rare cases, this might corrupt
the resulting disk image. If you find this to be the case, you can disable
compaction using this configuration value.
- `usb` (boolean) - Specifies whether to enable the USB bus when building
the VM. Defaults to `false`.
- `vm_name` (string) - This is the name of the PVM directory for the new
virtual machine, without the file extension. By default this is
"packer-BUILDNAME", where "BUILDNAME" is the name of the build.
## Boot Command
The `boot_command` configuration is very important: it specifies the keys to
type when the virtual machine is first booted in order to start the OS
installer. This command is typed after `boot_wait`, which gives the virtual
machine some time to actually load the ISO.
As documented above, the `boot_command` is an array of strings. The strings are
all typed in sequence. It is an array only to improve readability within the
template.
The boot command is "typed" character for character (using the Parallels
Virtualization SDK, see [Parallels Builder](/docs/builders/parallels.html))
simulating a human actually typing the keyboard.
@include 'partials/builders/boot-command.mdx'
Example boot command. This is actually a working boot command used to start an
Ubuntu 12.04 installer:
```text
[
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{ .Name }} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- <enter>;"
]
```
For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools.html#templates).
## prlctl Commands
In order to perform extra customization of the virtual machine, a template can
define extra calls to `prlctl` to perform.
[prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf)
is the command-line interface to Parallels Desktop. It can be used to configure
the advanced virtual machine options.
Extra `prlctl` commands are defined in the template in the `prlctl` section. In the
example below `prlctl` is used to explicitly enable the adaptive hypervisor, and
disable 3d acceleration:
```json
{
"prlctl": [
["set", "{{.Name}}", "--3d-accelerate", "off"],
["set", "{{.Name}}", "--adaptive-hypervisor", "on"]
]
}
```
The value of `prlctl` is an array of commands to execute. These commands are
executed in the order defined. So in the above example, 3d acceleration will be disabled
first, followed by the command which enables the adaptive hypervisor.
Each command itself is an array of strings, where each string is an argument to
`prlctl`. Each argument is treated as a [template engine](/docs/templates/engine.html). The only available
variable is `Name` which is replaced with the unique name of the VM, which is
required for many `prlctl` calls.

View File

@ -0,0 +1,222 @@
---
modeline: |
vim: set ft=pandoc:
description: |
This Parallels builder is able to create Parallels Desktop for Mac virtual
machines and export them in the PVM format, starting from an existing PVM
(exported virtual machine image).
layout: docs
page_title: Parallels PVM - Builders
sidebar_current: docs-builders-parallels-pvm
---
# Parallels Builder (from a PVM)
Type: `parallels-pvm`
This Parallels builder is able to create [Parallels Desktop for
Mac](https://www.parallels.com/products/desktop/) virtual machines and export
them in the PVM format, starting from an existing PVM (exported virtual machine
image).
The builder builds a virtual machine by importing an existing PVM file. It then
boots this image, runs provisioners on this new VM, and exports that VM to
create the image. The imported machine is deleted prior to finishing the build.
## Basic Example
Here is a basic example. This example is functional if you have an PVM matching
the settings here.
```json
{
"type": "parallels-pvm",
"parallels_tools_flavor": "lin",
"source_path": "source.pvm",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_timeout": "30s",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
}
```
It is important to add a `shutdown_command`. By default Packer halts the virtual
machine and the file system may not be sync'd. Thus, changes made in a
provisioner might not be saved.
## Configuration Reference
There are many configuration options available for the Parallels builder. They
are organized below into two categories: required and optional. Within each
category, the available options are alphabetized and described.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `parallels_tools_flavor` (string) - The flavor of the Parallels Tools ISO to
install into the VM. Valid values are "win", "lin", "mac", "os2"
and "other". This can be omitted only if `parallels_tools_mode`
is "disable".
- `source_path` (string) - The path to a PVM directory that acts as the source
of this build.
### Optional:
- `boot_command` (array of strings) - This is an array of commands to type
when the virtual machine is first booted. The goal of these commands should
be to type just enough to initialize the operating system installer. Special
keys can be typed as well, and are covered in the section below on the
boot command. If this is not specified, it is assumed the installer will
start itself.
- `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be
a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
five seconds and one minute 30 seconds, respectively. If this isn't
specified, the default is 10 seconds.
- `floppy_files` (array of strings) - A list of files to place onto a floppy
disk that is attached when the VM is booted. This is most useful for
unattended Windows installs, which look for an `Autounattend.xml` file on
removable media. By default, no floppy will be attached. All files listed in
this setting get placed into the root directory of the floppy and the floppy
is attached as the first floppy device. Currently, no support exists for
creating sub-directories on the floppy. Wildcard characters (\*, ?,
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `floppy_dirs` (array of strings) - A list of directories to place onto
the floppy disk recursively. This is similar to the `floppy_files` option
except that the directory structure is preserved. This is useful for when
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
By default, the floppy label will be 'packer'.
- `output_directory` (string) - This is the path to the directory where the
resulting virtual machine will be created. This may be relative or absolute.
If relative, the path is relative to the working directory when `packer`
is executed. This directory must not exist or be empty prior to running
the builder. By default this is "output-BUILDNAME" where "BUILDNAME" is the
name of the build.
- `parallels_tools_guest_path` (string) - The path in the VM to upload
Parallels Tools. This only takes effect if `parallels_tools_mode`
is "upload". This is a [configuration
template](/docs/templates/engine.html) that has a single
valid variable: `Flavor`, which will be the value of
`parallels_tools_flavor`. By default this is "prl-tools-{{.Flavor}}.iso"
which should upload into the login directory of the user.
- `parallels_tools_mode` (string) - The method by which Parallels Tools are
made available to the guest for installation. Valid options are "upload",
"attach", or "disable". If the mode is "attach" the Parallels Tools ISO will
be attached as a CD device to the virtual machine. If the mode is "upload"
the Parallels Tools ISO will be uploaded to the path specified by
`parallels_tools_guest_path`. The default value is "upload".
- `prlctl` (array of array of strings) - Custom `prlctl` commands to execute
in order to further customize the virtual machine being created. The value
of this is an array of commands to execute. The commands are executed in the
order defined in the template. For each command, the command is defined
itself as an array of strings, where each string represents a single
argument on the command-line to `prlctl` (but excluding `prlctl` itself).
Each arg is treated as a [configuration
template](/docs/templates/engine.html), where the `Name`
variable is replaced with the VM name. More details on how to use `prlctl`
are below.
- `prlctl_post` (array of array of strings) - Identical to `prlctl`, except
that it is run after the virtual machine is shutdown, and before the virtual
machine is exported.
- `prlctl_version_file` (string) - The path within the virtual machine to
upload a file that contains the `prlctl` version that was used to create
the machine. This information can be useful for provisioning. By default
this is ".prlctl_version", which will generally upload it into the
home directory.
- `reassign_mac` (boolean) - If this is "false" the MAC address of the first
NIC will reused when imported else a new MAC address will be generated
by Parallels. Defaults to "false".
- `shutdown_command` (string) - The command to use to gracefully shut down the
machine once all the provisioning is done. By default this is an empty
string, which tells Packer to just forcefully shut down the machine.
- `shutdown_timeout` (string) - The amount of time to wait after executing the
`shutdown_command` for the virtual machine to actually shut down. If it
doesn't shut down in this time, it is an error. By default, the timeout is
"5m", or five minutes.
- `skip_compaction` (boolean) - Virtual disk image is compacted at the end of
the build process using `prl_disk_tool` utility. In certain rare cases, this
might corrupt the resulting disk image. If you find this to be the case,
you can disable compaction using this configuration value.
- `vm_name` (string) - This is the name of the virtual machine when it is
imported as well as the name of the PVM directory when the virtual machine
is exported. By default this is "packer-BUILDNAME", where "BUILDNAME" is the
name of the build.
## Parallels Tools
After the virtual machine is up and the operating system is installed, Packer
uploads the Parallels Tools into the virtual machine. The path where they are
uploaded is controllable by `parallels_tools_path`, and defaults to
"prl-tools.iso". Without an absolute path, it is uploaded to the home directory
of the SSH user. Parallels Tools ISO's can be found in: "/Applications/Parallels
Desktop.app/Contents/Resources/Tools/"
## Boot Command
The `boot_command` specifies the keys to type when the virtual machine is first
booted. This command is typed after `boot_wait`.
As documented above, the `boot_command` is an array of strings. The strings are
all typed in sequence. It is an array only to improve readability within the
template.
The boot command is "typed" character for character (using the Parallels
Virtualization SDK, see [Parallels Builder](/docs/builders/parallels.html))
simulating a human actually typing the keyboard.
@include 'partials/builders/boot-command.mdx'
## prlctl Commands
In order to perform extra customization of the virtual machine, a template can
define extra calls to `prlctl` to perform.
[prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf)
is the command-line interface to Parallels Desktop. It can be used to configure
the virtual machine, such as set RAM, CPUs, etc.
Extra `prlctl` commands are defined in the template in the `prlctl` section. An
example is shown below that sets the memory and number of CPUs within the
virtual machine:
```json
{
"prlctl": [
["set", "{{.Name}}", "--memsize", "1024"],
["set", "{{.Name}}", "--cpus", "2"]
]
}
```
The value of `prlctl` is an array of commands to execute. These commands are
executed in the order defined. So in the above example, the memory will be set
followed by the CPUs.
Each command itself is an array of strings, where each string is an argument to
`prlctl`. Each argument is treated as a [configuration
template](/docs/templates/engine.html). The only available
variable is `Name` which is replaced with the unique name of the VM, which is
required for many `prlctl` calls.

View File

@ -0,0 +1,41 @@
---
description: |
The Parallels Packer builder is able to create Parallels Desktop for Mac
virtual machines and export them in the PVM format.
layout: docs
page_title: Parallels - Builders
sidebar_current: docs-builders-parallels
---
# Parallels Builder
The Parallels Packer builder is able to create [Parallels Desktop for
Mac](https://www.parallels.com/products/desktop/) virtual machines and export
them in the PVM format.
Packer actually comes with multiple builders able to create Parallels machines,
depending on the strategy you want to use to build the image. Packer supports
the following Parallels builders:
- [parallels-iso](/docs/builders/parallels-iso.html) - Starts from an ISO
file, creates a brand new Parallels VM, installs an OS, provisions software
within the OS, then exports that machine to create an image. This is best
for people who want to start from scratch.
- [parallels-pvm](/docs/builders/parallels-pvm.html) - This builder imports
an existing PVM file, runs provisioners on top of that VM, and exports that
machine to create an image. This is best if you have an existing Parallels
VM export you want to use as the source. As an additional benefit, you can
feed the artifact of this builder back into itself to iterate on a machine.
## Requirements
In addition to [Parallels Desktop for
Mac](https://www.parallels.com/products/desktop/) this requires the [Parallels
Virtualization SDK](https://www.parallels.com/downloads/desktop/).
The SDK can be installed by downloading and following the instructions in the
dmg.
Parallels Desktop for Mac 9 and later is supported, from PD 11 Pro or Business
edition is required.

View File

@ -0,0 +1,83 @@
---
description: The ProfitBricks builder is able to create images for ProfitBricks cloud.
layout: docs
page_title: ProfitBricks - Builders
sidebar_current: docs-builders-profitbricks
---
# ProfitBricks Builder
Type: `profitbricks`
The ProfitBricks Builder is able to create virtual machines for
[ProfitBricks](https://www.profitbricks.com).
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required
- `image` (string) - ProfitBricks volume image. Only Linux public images are
supported. To obtain full list of available images you can use
[ProfitBricks CLI](https://github.com/profitbricks/profitbricks-cli#image).
- `password` (string) - ProfitBricks password. This can be specified via
environment variable \`PROFITBRICKS_PASSWORD', if provided. The value
defined in the config has precedence over environemnt variable.
- `username` (string) - ProfitBricks username. This can be specified via
environment variable \`PROFITBRICKS_USERNAME', if provided. The value
defined in the config has precedence over environemnt variable.
### Optional
- `cores` (number) - Amount of CPU cores to use for this build. Defaults to
"4".
- `disk_size` (string) - Amount of disk space for this image in GB. Defaults
to "50"
- `disk_type` (string) - Type of disk to use for this image. Defaults to
"HDD".
- `location` (string) - Defaults to "us/las".
- `ram` (number) - Amount of RAM to use for this image. Defaults to "2048".
- `retries` (string) - Number of retries Packer will make status requests
while waiting for the build to complete. Default value 120 seconds.
- `snapshot_name` (string) - If snapshot name is not provided Packer will
generate it
- `snapshot_password` (string) - Password for the snapshot.
- `url` (string) - Endpoint for the ProfitBricks REST API. Default URL
"<https://api.profitbricks.com/rest/v2>"
## Example
Here is a basic example:
```json
{
"builders": [
{
"image": "Ubuntu-16.04",
"type": "profitbricks",
"disk_size": "5",
"snapshot_name": "double",
"snapshot_password": "test1234",
"ssh_username": "root",
"timeout": 100
}
]
}
```

View File

@ -0,0 +1,248 @@
---
description: |
The proxmox Packer builder is able to create new images for use with
Proxmox VE. The builder takes an ISO source, runs any provisioning
necessary on the image after launching it, then creates a virtual machine
template.
layout: docs
page_title: 'Proxmox - Builders'
sidebar_current: 'docs-builders-proxmox'
---
# Proxmox Builder
Type: `proxmox`
The `proxmox` Packer builder is able to create new images for use with
[Proxmox](https://www.proxmox.com/en/proxmox-ve). The builder takes an ISO
image, runs any provisioning necessary on the image after launching it, then
creates a virtual machine template. This template can then be used as to
create new virtual machines within Proxmox.
The builder does _not_ manage templates. Once it creates a template, it is up
to you to use it or delete it.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `proxmox_url` (string) - URL to the Proxmox API, including the full path,
so `https://<server>:<port>/api2/json` for example.
Can also be set via the `PROXMOX_URL` environment variable.
- `username` (string) - Username when authenticating to Proxmox, including
the realm. For example `user@pve` to use the local Proxmox realm.
Can also be set via the `PROXMOX_USERNAME` environment variable.
- `password` (string) - Password for the user.
Can also be set via the `PROXMOX_PASSWORD` environment variable.
- `node` (string) - Which node in the Proxmox cluster to start the virtual
machine on during creation.
- `iso_file` (string) - Path to the ISO file to boot from, expressed as a
proxmox datastore path, for example
`local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso`.
Either `iso_file` OR `iso_url` must be specifed.
- `iso_url` (string) - URL to an ISO file to upload to Proxmox, and then
boot from. Either `iso_file` OR `iso_url` must be specifed.
- `iso_storage_pool` (string) - Proxmox storage pool onto which to upload
the ISO file.
- `iso_checksum` (string) - Checksum of the ISO file.
- `iso_checksum_type` (string) - Type of the checksum. Can be md5, sha1,
sha256, sha512 or none. Corruption of large files, such as ISOs, can occur
during transfer from time to time. As such, setting this to none is not
recommended.
### Optional:
- `insecure_skip_tls_verify` (bool) - Skip validating the certificate.
- `pool` (string) - Name of resource pool to create virtual machine in.
- `vm_name` (string) - Name of the virtual machine during creation. If not
given, a random uuid will be used.
- `vm_id` (int) - The ID used to reference the virtual machine. This will
also be the ID of the final template. If not given, the next free ID on
the node will be used.
- `memory` (int) - How much memory, in megabytes, to give the virtual
machine. Defaults to `512`.
- `cores` (int) - How many CPU cores to give the virtual machine. Defaults
to `1`.
- `sockets` (int) - How many CPU sockets to give the virtual machine.
Defaults to `1`
- `cpu_type` (string) - The CPU type to emulate. See the Proxmox API
documentation for the complete list of accepted values. For best
performance, set this to `host`. Defaults to `kvm64`.
- `os` (string) - The operating system. Can be `wxp`, `w2k`, `w2k3`, `w2k8`,
`wvista`, `win7`, `win8`, `win10`, `l24` (Linux 2.4), `l26` (Linux 2.6+),
`solaris` or `other`. Defaults to `other`.
- `vga` (object) - The graphics adapter to use. Example:
```json
{
"type": "vmware",
"memory": 32
}
```
- `type` (string) - Can be `cirrus`, `none`, `qxl`,`qxl2`, `qxl3`,
`qxl4`, `serial0`, `serial1`, `serial2`, `serial3`, `std`, `virtio`, `vmware`.
Defaults to `std`.
- `memory` (int) - How much memory to assign.
- `network_adapters` (array of objects) - Network adapters attached to the
virtual machine. Example:
```json
[
{
"model": "virtio",
"bridge": "vmbr0",
"vlan_tag": "10"
}
]
```
- `bridge` (string) - Required. Which Proxmox bridge to attach the
adapter to.
- `model` (string) - Model of the virtual network adapter. Can be
`rtl8139`, `ne2k_pci`, `e1000`, `pcnet`, `virtio`, `ne2k_isa`,
`i82551`, `i82557b`, `i82559er`, `vmxnet3`, `e1000-82540em`,
`e1000-82544gc` or `e1000-82545em`. Defaults to `e1000`.
- `mac_address` (string) - Give the adapter a specific MAC address. If
not set, defaults to a random MAC.
- `vlan_tag` (string) - If the adapter should tag packets. Defaults to
no tagging.
- `disks` (array of objects) - Disks attached to the virtual machine.
Example:
```json
[
{
"type": "scsi",
"disk_size": "5G",
"storage_pool": "local-lvm",
"storage_pool_type": "lvm"
}
]
```
- `storage_pool` (string) - Required. Name of the Proxmox storage pool
to store the virtual machine disk on. A `local-lvm` pool is allocated
by the installer, for example.
- `storage_pool_type` (string) - Required. The type of the pool, can
be `lvm`, `lvm-thin`, `zfspool` or `directory`.
- `type` (string) - The type of disk. Can be `scsi`, `sata`, `virtio` or
`ide`. Defaults to `scsi`.
- `disk_size` (string) - The size of the disk, including a unit suffix, such
as `10G` to indicate 10 gigabytes.
- `cache_mode` (string) - How to cache operations to the disk. Can be
`none`, `writethrough`, `writeback`, `unsafe` or `directsync`.
Defaults to `none`.
- `format` (string) - The format of the file backing the disk. Can be
`raw`, `cow`, `qcow`, `qed`, `qcow2`, `vmdk` or `cloop`. Defaults to
`raw`.
- `template_name` (string) - Name of the template. Defaults to the generated
name used during creation.
- `template_description` (string) - Description of the template, visible in
the Proxmox interface.
- `unmount_iso` (bool) - If true, remove the mounted ISO from the template
after finishing. Defaults to `false`.
- `onboot` (boolean) - Specifies whether a VM will be started during system
bootup. Defaults to `false`.
- `qemu_agent` (boolean) - Disables QEMU Agent option for this VM. When enabled,
then `qemu-guest-agent` must be installed on the guest. When disabled, then
`ssh_host` should be used. Defaults to `true`.
- `scsi_controller` (string) - The SCSI controller model to emulate. Can be `lsi`,
`lsi53c810`, `virtio-scsi-pci`, `virtio-scsi-single`, `megasas`, or `pvscsi`.
Defaults to `lsi`.
## Example: Fedora with kickstart
Here is a basic example creating a Fedora 29 server image with a Kickstart
file served with Packer's HTTP server. Note that the iso file needs to be
manually downloaded.
```json
{
"variables": {
"username": "apiuser@pve",
"password": "supersecret"
},
"builders": [
{
"type": "proxmox",
"proxmox_url": "https://my-proxmox.my-domain:8006/api2/json",
"insecure_skip_tls_verify": true,
"username": "{{user `username`}}",
"password": "{{user `password`}}",
"node": "my-proxmox",
"network_adapters": [
{
"bridge": "vmbr0"
}
],
"disks": [
{
"type": "scsi",
"disk_size": "5G",
"storage_pool": "local-lvm",
"storage_pool_type": "lvm"
}
],
"iso_file": "local:iso/Fedora-Server-dvd-x86_64-29-1.2.iso",
"http_directory": "config",
"boot_wait": "10s",
"boot_command": [
"<up><tab> ip=dhcp inst.cmdline inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg<enter>"
],
"ssh_username": "root",
"ssh_timeout": "15m",
"ssh_password": "packer",
"unmount_iso": true,
"template_name": "fedora-29",
"template_description": "Fedora 29-1.2, generated on {{ isotime \"2006-01-02T15:04:05Z\" }}"
}
]
}
```

View File

@ -2,10 +2,10 @@
modeline: |
vim: set ft=pandoc:
description: |
The Qemu Packer builder is able to create KVM and Xen virtual machine images.
The Qemu Packer builder is able to create KVM and Xen virtual machine images.
layout: docs
page_title: 'QEMU - Builders'
sidebar_current: 'docs-builders-qemu'
page_title: QEMU - Builders
sidebar_current: docs-builders-qemu
---
# QEMU Builder
@ -28,8 +28,7 @@ to files, URLS for ISOs and checksums.
```json
{
"builders":
[
"builders": [
{
"type": "qemu",
"iso_url": "http://mirror.raystedman.net/centos/6/isos/x86_64/CentOS-6.9-x86_64-minimal.iso",
@ -82,58 +81,57 @@ necessary for this build to succeed and can be found further down the page.
### Optional:
<%= partial "partials/builder/qemu/Config-not-required" %>
@include 'partials/builder/qemu/Config-not-required.mdx'
## ISO Configuration
<%= partial "partials/common/ISOConfig" %>
@include 'partials/common/ISOConfig.mdx'
### Required:
<%= partial "partials/common/ISOConfig-required" %>
@include 'partials/common/ISOConfig-required.mdx'
### Optional:
<%= partial "partials/common/ISOConfig-not-required" %>
@include 'partials/common/ISOConfig-not-required.mdx'
## Http directory configuration
<%= partial "partials/common/HTTPConfig" %>
@include 'partials/common/HTTPConfig.mdx'
### Optional:
<%= partial "partials/common/HTTPConfig-not-required" %>
@include 'partials/common/HTTPConfig-not-required.mdx'
## Floppy configuration
<%= partial "partials/common/FloppyConfig" %>
@include 'partials/common/FloppyConfig.mdx'
### Optional:
<%= partial "partials/common/FloppyConfig-not-required" %>
@include 'partials/common/FloppyConfig-not-required.mdx'
## Shutdown configuration
### Optional:
<%= partial "partials/common/shutdowncommand/ShutdownConfig-not-required" %>
@include 'partials/common/shutdowncommand/ShutdownConfig-not-required.mdx'
## Boot Configuration
<%= partial "partials/common/bootcommand/VNCConfig" %>
<%= partial "partials/common/bootcommand/BootConfig" %>
@include 'partials/common/bootcommand/VNCConfig.mdx'
@include 'partials/common/bootcommand/BootConfig.mdx'
### Optional:
<%= partial "partials/common/bootcommand/VNCConfig-not-required" %>
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
@include 'partials/common/bootcommand/VNCConfig-not-required.mdx'
@include 'partials/common/bootcommand/BootConfig-not-required.mdx'
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
### Troubleshooting

View File

@ -0,0 +1,110 @@
---
description: >
The Scaleway Packer builder is able to create new images for use with Scaleway
BareMetal and Virtual cloud server. The builder takes a source image, runs any
provisioning necessary on the image after launching it, then snapshots it into
a reusable image. This reusable image can then be used as the foundation of
new
servers that are launched within Scaleway.
layout: docs
page_title: Scaleway - Builders
sidebar_current: docs-builders-scaleway
---
# Scaleway Builder
Type: `scaleway`
The `scaleway` Packer builder is able to create new images for use with
[Scaleway](https://www.scaleway.com). The builder takes a source image, runs
any provisioning necessary on the image after launching it, then snapshots it
into a reusable image. This reusable image can then be used as the foundation
of new servers that are launched within Scaleway.
The builder does _not_ manage snapshots. Once it creates an image, it is up to
you to use it or delete it.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `organization_id` (string) - The organization id to use to identify your
organization. It can also be specified via environment variable
`SCALEWAY_ORGANIZATION`. Your organization id is available in the
["Account" section](https://cloud.scaleway.com/#/account) of the
control panel.
Previously named: `api_access_key` with environment variable: `SCALEWAY_API_ACCESS_KEY`
- `api_token` (string) - The token to use to authenticate with your account.
It can also be specified via environment variable `SCALEWAY_API_TOKEN`. You
can see and generate tokens in the ["Credentials"
section](https://cloud.scaleway.com/#/credentials) of the control panel.
- `image` (string) - The UUID of the base image to use. This is the image
that will be used to launch a new server and provision it. See
[the images list](https://api-marketplace.scaleway.com/images)
get the complete list of the accepted image UUID.
- `region` (string) - The name of the region to launch the server in (`par1`
or `ams1`). Consequently, this is the region where the snapshot will be
available.
- `commercial_type` (string) - The name of the server commercial type:
`ARM64-128GB`, `ARM64-16GB`, `ARM64-2GB`, `ARM64-32GB`, `ARM64-4GB`,
`ARM64-64GB`, `ARM64-8GB`, `C1`, `C2L`, `C2M`, `C2S`, `START1-L`,
`START1-M`, `START1-S`, `START1-XS`, `X64-120GB`, `X64-15GB`, `X64-30GB`,
`X64-60GB`
### Optional:
- `server_name` (string) - The name assigned to the server. Default
`packer-UUID`
- `image_name` (string) - The name of the resulting image that will appear in
your account. Default `packer-TIMESTAMP`
- `snapshot_name` (string) - The name of the resulting snapshot that will
appear in your account. Default `packer-TIMESTAMP`
- `boottype` (string) - The type of boot, can be either `local` or
`bootscript`. Default `bootscript`
- `bootscript` (string) - The id of an existing bootscript to use when
booting the server.
- `remove_volume` (boolean) - Force Packer to delete volume associated with
the resulting snapshot after the build. Default `false`.
## Basic Example
Here is a basic example. It is completely valid as soon as you enter your own
access tokens:
```json
{
"type": "scaleway",
"organization_id": "YOUR ORGANIZATION ID",
"api_token": "YOUR TOKEN",
"image": "UUID OF THE BASE IMAGE",
"region": "par1",
"commercial_type": "START1-S",
"ssh_username": "root",
"ssh_private_key_file": "~/.ssh/id_rsa"
}
```
When you do not specified the `ssh_private_key_file`, a temporarily SSH keypair
is generated to connect the server. This key will only allow the `root` user to
connect the server.

View File

@ -0,0 +1,168 @@
---
description: |
The `tencentcloud-cvm` Packer builder plugin provide the capability to build
customized images based on an existing base images.
layout: docs
page_title: Tencentcloud Image Builder
sidebar_current: docs-builders-tencentcloud-cvm
---
# Tencentcloud Image Builder
Type: `tencentcloud-cvm`
The `tencentcloud-cvm` Packer builder plugin provide the capability to build
customized images based on an existing base images.
## Configuration Reference
The following configuration options are available for building Tencentcloud images.
In addition to the options listed here,
a [communicator](/docs/templates/communicator.html) can be configured for this builder.
### Required:
- `secret_id` (string) - Tencentcloud secret id. You should set it directly,
or set the `TENCENTCLOUD_ACCESS_KEY` environment variable.
- `secret_key` (string) - Tencentcloud secret key. You should set it directly,
or set the `TENCENTCLOUD_SECRET_KEY` environment variable.
- `region` (string) - The region where your cvm will be launch. You should
reference [Region and Zone](https://intl.cloud.tencent.com/document/product/213/6091)
for parameter taking.
- `zone` (string) - The zone where your cvm will be launch. You should
reference [Region and Zone](https://intl.cloud.tencent.com/document/product/213/6091)
for parameter taking.
- `instance_type` (string) - The instance type your cvm will be launched by.
You should reference [Instace Type](https://intl.cloud.tencent.com/document/product/213/11518)
for parameter taking.
- `source_image_id` (string) - The base image id of Image you want to create
your customized image from.
- `image_name` (string) - The name you want to create your customize image,
it should be composed of no more than 60 characters, of letters, numbers
or minus sign.
### Optional:
- `force_poweroff` (boolean) - Indicates whether to perform a forced shutdown to
create an image when soft shutdown fails. Default value is `false`.
- `image_description` (string) - Image description. It should no more than 60 characters.
- `reboot` (boolean, **deprecated**) - Whether shutdown cvm to create Image.
Please refer to parameter `force_poweroff`.
- `sysprep` (boolean) - Whether enable Sysprep during creating windows image.
- `image_copy_regions` (array of strings) - Regions that will be copied to after
your image created.
- `image_share_accounts` (array of strings) - Accounts that will be shared to
after your image created.
- `skip_region_validation` (boolean) - Do not check region and zone when validate.
- `associate_public_ip_address` (boolean) - Whether allocate public ip to your cvm.
Default value is `false`.
If not set, you could access your cvm from the same vpc.
- `internet_max_bandwidth_out` (number) - Max bandwidth out your cvm will be launched by(in MB).
values can be set between 1 ~ 100.
- `instance_name` (string) - Instance name.
- `disk_type` (string) - Root disk type your cvm will be launched by. you could
reference [Disk Type](https://intl.cloud.tencent.com/document/product/213/15753#SystemDisk)
for parameter taking.
- `disk_size` (number) - Root disk size your cvm will be launched by. values range(in GB):
- LOCAL_BASIC: 50
- Other: 50 ~ 1000 (need whitelist if > 50)
- `data_disks` (array of data disks) - Add one or more data disks to the instance before creating the
image. Note that if the source image has data disk snapshots, this argument will be ignored, and
the running instance will use source image data disk settings, in such case, `disk_type`
argument will be used as disk type for all data disks, and each data disk size will use the
origin value in source image.
The data disks allow for the following argument:
- `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`.
- `disk_size` - Size of the data disk.
- `disk_snapshot_id` - Id of the snapshot for a data disk.
- `vpc_id` (string) - Specify vpc your cvm will be launched by.
- `vpc_name` (string) - Specify vpc name you will create. if `vpc_id` is not set, packer will
create a vpc for you named this parameter.
- `cidr_block` (boolean) - Specify cider block of the vpc you will create if `vpc_id` is not set.
- `subnet_id` (string) - Specify subnet your cvm will be launched by.
- `subnet_name` (string) - Specify subnet name you will create. if `subnet_id` is not set, packer will
create a subnet for you named this parameter.
- `subnect_cidr_block` (boolean) - Specify cider block of the subnet you will create if
`subnet_id` is not set.
- `security_group_id` (string) - Specify security group your cvm will be launched by.
- `security_group_name` (string) - Specify security name you will create if `security_group_id` is not set.
- `user_data` (string) - userdata.
- `user_data_file` (string) - userdata file.
- `host_name` (string) - host name.
- `run_tags` (map of strings) - Tags to apply to the instance that is _launched_ to create the image.
These tags are _not_ applied to the resulting image.
## Basic Example
Here is a basic example for Tencentcloud.
```json
{
"variables": {
"secret_id": "{{env `TENCENTCLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `TENCENTCLOUD_SECRET_KEY`}}"
},
"builders": [
{
"type": "tencentcloud-cvm",
"secret_id": "{{user `secret_id`}}",
"secret_key": "{{user `secret_key`}}",
"region": "ap-guangzhou",
"zone": "ap-guangzhou-4",
"instance_type": "S4.SMALL1",
"source_image_id": "img-oikl1tzv",
"ssh_username": "root",
"image_name": "PackerTest",
"disk_type": "CLOUD_PREMIUM",
"packer_debug": true,
"associate_public_ip_address": true,
"run_tags": {
"good": "luck"
}
}
],
"provisioners": [
{
"type": "shell",
"inline": ["sleep 30", "yum install redis.x86_64 -y"]
}
]
}
```
See the
[examples/tencentcloud](https://github.com/hashicorp/packer/tree/master/examples/tencentcloud)
folder in the packer project for more examples.

View File

@ -0,0 +1,214 @@
---
description: >
The triton Packer builder is able to create new images for use with Triton.
These images can be used with both the Joyent public cloud (which is powered
by
Triton) as well with private Triton installations. This builder uses the
Triton
Cloud API to create images.
layout: docs
page_title: Triton - Builders
sidebar_current: docs-builders-triton
---
# Triton Builder
Type: `triton`
The `triton` Packer builder is able to create new images for use with Triton.
These images can be used with both the [Joyent public
cloud](https://www.joyent.com/) (which is powered by Triton) as well with
private [Triton](https://github.com/joyent/triton) installations.
This builder uses the Triton Cloud API to create these images. Triton also
supports the Docker API however this builder does _not_. If you want to create
Docker images on Triton you should use the Packer Docker builder.
The builder creates and launches a temporary VM based on a specified source
image, runs any provisioning necessary, uses the Triton "VM to image"
functionality to create a reusable image and finally destroys the temporary VM.
This reusable image can then be used to launch new machines.
The builder does _not_ manage images. Once it creates an image, it is up to you
to use it or delete it.
\~&gt; **Private installations of Triton must have custom images enabled!** To
use the Triton builder with a private/on-prem installation of Joyent's Triton
software, you'll need an operator to manually [enable custom
images](https://docs.joyent.com/private-cloud/install/image-management) after
installing Triton. This is not a requirement for Joyent's public cloud offering
of Triton.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `triton_account` (string) - The username of the Triton account to use when
using the Triton Cloud API.
- `triton_key_id` (string) - The fingerprint of the public key of the SSH key
pair to use for authentication with the Triton Cloud API. If
`triton_key_material` is not set, it is assumed that the SSH agent has the
private key corresponding to this key ID loaded.
- `source_machine_image` (string) - The UUID of the image to base the new
image on. Triton supports multiple types of images, called 'brands' in
Triton / Joyent lingo, for contains and VM's. See the chapter [Containers
and virtual machines](https://docs.joyent.com/public-cloud/instances) in
the Joyent Triton documentation for detailed information. The following
brands are currently supported by this builder:`joyent` and`kvm`. The
choice of base image automatically decides the brand. On the Joyent public
cloud a valid `source_machine_image` could for example be
`70e3ae72-96b6-11e6-9056-9737fd4d0764` for version 16.3.1 of the 64bit
SmartOS base image (a 'joyent' brand image). `source_machine_image_filter`
can be used to populate this UUID.
- `source_machine_package` (string) - The Triton package to use while
building the image. Does not affect (and does not have to be the same) as
the package which will be used for a VM instance running this image. On the
Joyent public cloud this could for example be `g3-standard-0.5-smartos`.
- `image_name` (string) - The name the finished image in Triton will be
assigned. Maximum 512 characters but should in practice be much shorter
(think between 5 and 20 characters). For example `postgresql-95-server` for
an image used as a PostgreSQL 9.5 server.
- `image_version` (string) - The version string for this image. Maximum 128
characters. Any string will do but a format of `Major.Minor.Patch` is
strongly advised by Joyent. See [Semantic Versioning](http://semver.org/)
for more information on the `Major.Minor.Patch` versioning format.
### Optional:
- `triton_url` (string) - The URL of the Triton cloud API to use. If omitted
it will default to the `us-sw-1` region of the Joyent Public cloud. If you
are using your own private Triton installation you will have to supply the
URL of the cloud API of your own Triton installation.
- `triton_key_material` (string) - Path to the file in which the private key
of `triton_key_id` is stored. For example `/home/soandso/.ssh/id_rsa`. If
this is not specified, the SSH agent is used to sign requests with the
`triton_key_id` specified.
- `triton_user` (string) - The username of a user who has access to your
Triton account.
- `insecure_skip_tls_verify` - (bool) This allows skipping TLS verification
of the Triton endpoint. It is useful when connecting to a temporary Triton
installation such as Cloud-On-A-Laptop which does not generally use a
certificate signed by a trusted root CA. The default is `false`.
- `source_machine_firewall_enabled` (boolean) - Whether or not the firewall
of the VM used to create an image of is enabled. The Triton firewall only
filters inbound traffic to the VM. All outbound traffic is always allowed.
Currently this builder does not provide an interface to add specific
firewall rules. Unless you have a global rule defined in Triton which
allows SSH traffic enabling the firewall will interfere with the SSH
provisioner. The default is `false`.
- `source_machine_metadata` (object of key/value strings) - Triton metadata
applied to the VM used to create the image. Metadata can be used to pass
configuration information to the VM without the need for networking. See
[Using the metadata
API](https://docs.joyent.com/private-cloud/instances/using-mdata) in the
Joyent documentation for more information. This can for example be used to
set the `user-script` metadata key to have Triton start a user supplied
script after the VM has booted.
- `source_machine_name` (string) - Name of the VM used for building the
image. Does not affect (and does not have to be the same) as the name for a
VM instance running this image. Maximum 512 characters but should in
practice be much shorter (think between 5 and 20 characters). For example
`mysql-64-server-image-builder`. When omitted defaults to
`packer-builder-[image_name]`.
- `source_machine_networks` (array of strings) - The UUID's of Triton
networks added to the source machine used for creating the image. For
example if any of the provisioners which are run need Internet access you
will need to add the UUID's of the appropriate networks here. If this is
not specified, instances will be placed into the default Triton public and
internal networks.
- `source_machine_tags` (object of key/value strings) - Tags applied to the
VM used to create the image.
- `image_acls` (array of strings) - The UUID's of the users which will have
access to this image. When omitted only the owner (the Triton user whose
credentials are used) will have access to the image.
- `image_description` (string) - Description of the image. Maximum 512
characters.
- `image_eula_url` (string) - URL of the End User License Agreement (EULA)
for the image. Maximum 128 characters.
- `image_homepage` (string) - URL of the homepage where users can find
information about the image. Maximum 128 characters.
- `image_tags` (object of key/value strings) - Tag applied to the image.
- `source_machine_image_filter` (object) - Filters used to populate the
`source_machine_image` field. Example:
```json
{
"source_machine_image_filter": {
"name": "ubuntu-16.04",
"type": "lx-dataset",
"most_recent": true
}
}
```
## Basic Example
Below is a minimal example to create an image on the Joyent public cloud:
```json
{
"builders": [
{
"type": "triton",
"triton_account": "triton_username",
"triton_key_id": "6b:95:03:3d:d3:6e:52:69:01:96:1a:46:4a:8d:c1:7e",
"source_machine_name": "image-builder",
"source_machine_package": "g4-highcpu-128M",
"source_machine_image_filter": {
"name": "ubuntu-16.04",
"type": "lx-dataset",
"most_recent": "true"
},
"ssh_username": "root",
"image_name": "my_new_image",
"image_version": "1.0.0"
}
]
}
```
In the above example the SSH key used for `triton_key_material` (connecting to
the Cloud API) and the `ssh_private_key_file` (connecting to the VM once it has
started) are the same. This is because Triton automatically configures the root
users to be able to login via SSH with the same key used to create the VM via
the Cloud API. In more advanced scenarios for example when using a
`source_machine_image` one might use different credentials.
Available `triton_key_id`, `source_machine_package`, `source_machine_image`,
and `source_machine_networks` can be found by using the following [Triton
CLI](https://docs.joyent.com/public-cloud/api-access/cloudapi) commands:
`triton key list`, `triton package list`, `triton image list`, and
`triton network list` respectively.

View File

@ -0,0 +1,157 @@
---
description: |
The `ucloud-uhost` Packer builder plugin provides the capability to build
customized images based on an existing base images.
layout: docs
page_title: UCloud Image Builder
sidebar_current: docs-builders-ucloud-uhost
---
# UCloud Image Builder
Type: `ucloud-uhost`
The `ucloud-uhost` Packer builder plugin provides the capability to build
customized images based on an existing base images.
This builder builds an UCloud image by launching an UHost instance from a source image,
provisioning that running machine, and then creating an image from that machine.
## Configuration Reference
The following configuration options are available for building UCloud images. They are
segmented below into two categories: required and optional parameters.
In addition to the options listed here, a
[communicator](../templates/communicator.html) can be configured for this
builder.
\~&gt; **Note:** The builder doesn't support Windows images for now and only supports CentOS and Ubuntu images via SSH authentication with `ssh_username` (Required) and `ssh_password` (Optional). The `ssh_username` must be `root` for CentOS images and `ubuntu` for Ubuntu images. The `ssh_password` may contain 8-30 characters, and must consist of at least 2 items out of the capital letters, lower case letters, numbers and special characters. The special characters include <code>`()~!@#\$%^&\*-+=\_|{}\[]:;'<>,.?/</code>.
### Required:
- `public_key` - (string) This is the UCloud public key. It must be provided, but it can also be sourced from the `UCLOUD_PUBLIC_KEY` environment variable.
- `private_key` - (string) This is the UCloud private key. It must be provided, but it can also be sourced from the `UCLOUD_PRIVATE_KEY` environment variable.
- `project_id` - (string) This is the UCloud project id. It must be provided, but it can also be sourced from the `UCLOUD_PROJECT_ID` environment variables.
- `region` - (string) This is the UCloud region. It must be provided, but it can also be sourced from the `UCLOUD_REGION` environment variables.
- `availability_zone` - (string) This is the UCloud availability zone where UHost instance is located. such as: `cn-bj2-02`. You may refer to [list of availability_zone](https://docs.ucloud.cn/api/summary/regionlist)
- `instance_type` - (string) The type of UHost instance. You may refer to [list of instance type](https://docs.ucloud.cn/compute/terraform/specification/instance)
- `image_name` - (string) The name of the user-defined image, which contains 1-63 characters and only support Chinese, English, numbers, '-\_,.:[]'.
- `source_image_id` (string) - This is the ID of base image which you want to create your customized images with.
### Optional:
- `base_url` - (string) This is the base url. (Default: `https://api.ucloud.cn`).
- `use_ssh_private_ip` - (boolean) - If this value is true, packer will connect to the created UHost instance via a private ip instead of allocating an EIP (elastic public ip).(Default: `false`).
\~&gt; **Note:** By default (`use_ssh_private_ip` is `false`), the launched uhost instance will be connecting with extranet by bounding with an EIP (elastic public ip) automatically, which bandwidth is 30 Mb by default and paid by traffic.
- `vpc_id` - (string) The ID of VPC linked to the UHost instance. If not defined `vpc_id`, the instance will use the default VPC in the current region.
- `subnet_id` - (string) The ID of subnet under the VPC. If `vpc_id` is defined, the `subnet_id` is mandatory required. If `vpc_id` and `subnet_id` are not defined, the instance will use the default subnet in the current region.
- `security_group_id` - (string) The ID of the fire wall associated to UHost instance. If `security_group_id` is not defined,
the instance will use the non-recommended web fire wall, and open port include 22, 3389 by default. It is supported by ICMP fire wall protocols.
You may refer to [security group_id](https://docs.ucloud.cn/network/firewall/firewall.html).
- `image_description` (string) - The description of the image.
- `instance_name` (string) - The name of instance, which contains 1-63 characters and only support Chinese, English, numbers, '-', '\_', '.'.
- `boot_disk_type` - (string) The type of boot disk associated to UHost instance.
Possible values are: `cloud_ssd` for cloud boot disk, `local_normal` and `local_ssd` for local boot disk. (Default: `cloud_ssd`).
The `cloud_ssd` and `local_ssd` are not fully supported by all regions as boot disk type, please proceed to UCloud console for more details.
\~&gt; **Note:** It takes around 10 mins for boot disk initialization when `boot_disk_type` is `local_normal` or `local_ssd`.
- `image_copy_to_mappings` (array of copied image mappings) - The array of mappings regarding the copied images to the destination regions and projects.
- `project_id` (string) - The destination project id, where copying image in.
- `region` (string) - The destination region, where copying image in.
- `name` (string) - The copied image name. If not defined, builder will use `image_name` as default name.
- `description` (number) - The copied image description.
- `wait_image_ready_timeout` (int)Timeout of creating image or copying image. The default timeout is 3600 seconds if this option is not set or is set to 0.
## Examples
Here is a basic example for build UCloud CentOS image:
```json
{
"variables": {
"ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}",
"ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}",
"ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}"
},
"builders": [
{
"type": "ucloud-uhost",
"public_key": "{{user `ucloud_public_key`}}",
"private_key": "{{user `ucloud_private_key`}}",
"project_id": "{{user `ucloud_project_id`}}",
"region": "cn-bj2",
"availability_zone": "cn-bj2-02",
"instance_type": "n-basic-2",
"source_image_id": "uimage-f1chxn",
"ssh_username": "root",
"image_name": "packer_test_{{timestamp}}"
}
]
}
```
Here is a example for build UCloud Ubuntu image:
```json
{
"variables": {
"ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}",
"ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}",
"ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}",
"password": "ucloud_2019"
},
"builders": [
{
"type": "ucloud-uhost",
"public_key": "{{user `ucloud_public_key`}}",
"private_key": "{{user `ucloud_private_key`}}",
"project_id": "{{user `ucloud_project_id`}}",
"region": "cn-bj2",
"availability_zone": "cn-bj2-02",
"instance_type": "n-basic-2",
"source_image_id": "uimage-irofn4",
"ssh_password": "{{user `password`}}",
"ssh_username": "ubuntu",
"image_name": "packer-test-ubuntu-bj"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo '{{user `password`}}' | sudo -S '{{.Path}}'",
"inline": ["sleep 30", "sudo apt update", "sudo apt install nginx -y"]
}
]
}
```
-&gt; **Note:** Packer can also read the public key and private key from
environmental variables. See the configuration reference in the section above
for more information on what environmental variables Packer will look for.
\~&gt; **Note:** Source image may be deprecated after a while, you can use the tools like `UCloud CLI` to run `ucloud image list` to find one that exists.

View File

@ -0,0 +1,175 @@
---
description: |
The Vagrant Packer builder is able to launch Vagrant boxes and
re-package them into .box files
layout: docs
page_title: Vagrant - Builders
sidebar_current: docs-builders-vagrant
---
# Vagrant Builder
The Vagrant builder is intended for building new boxes from already-existing
boxes. Your source should be a URL or path to a .box file or a Vagrant Cloud
box name such as `hashicorp/precise64`.
Packer will not install vagrant, nor will it install the underlying
virtualization platforms or extra providers; We expect when you run this
builder that you have already installed what you need.
By default, this builder will initialize a new Vagrant workspace, launch your
box from that workspace, provision it, call `vagrant package` to package it
into a new box, and then destroy the original box. Please note that vagrant
will _not_ remove the box file from your system (we don't call
`vagrant box remove`).
You can change the behavior so that the builder doesn't destroy the box by
setting the `teardown_method` option. You can change the behavior so the builder
doesn't package it (not all provisioners support the `vagrant package` command)
by setting the `skip package` option. You can also change the behavior so that
rather than initializing a new Vagrant workspace, you use an already defined
one, by using `global_id` instead of `source_box`.
Please note that if you are using the Vagrant builder, then the Vagrant
post-processor is unnecesary because the output of the Vagrant builder is
already a Vagrant box; using that post-processor with the Vagrant builder will
cause your build to fail. Similarly, since Vagrant boxes are already compressed,
the Compress post-processor will not work with this builder.
## Configuration Reference
### Required:
- `source_path` (string) - URL of the vagrant box to use, or the name of the
vagrant box. `hashicorp/precise64`, `./mylocalbox.box` and
`https://example.com/my-box.box` are all valid source boxes. If your
source is a .box file, whether locally or from a URL like the latter example
above, you will also need to provide a `box_name`. This option is required,
unless you set `global_id`. You may only set one or the other, not both.
or
- `global_id` (string) - the global id of a Vagrant box already added to Vagrant
on your system. You can find the global id of your Vagrant boxes using the
command `vagrant global-status`; your global_id will be a 7-digit number and
letter combination that you'll find in the leftmost column of the
global-status output. If you choose to use `global_id` instead of
`source_box`, Packer will skip the Vagrant initialize and add steps, and
simply launch the box directly using the global id.
### Optional:
- `output_dir` (string) - The directory to create that will contain
your output box. We always create this directory and run from inside of it to
prevent Vagrant init collisions. If unset, it will be set to `packer-` plus
your buildname.
- `box_name` (string) - if your source_box is a boxfile that we need to add
to Vagrant, this is the name to give it. If left blank, will default to
"packer\_" plus your buildname.
- `provider` (string) - The vagrant [provider](docs/post-processors/vagrant.html).
This parameter is required when `source_path` have more than one provider,
or when using `vagrant-cloud` post-processor. Defaults to unset.
- `checksum` (string) - The checksum for the .box file. The type of the
checksum is specified with `checksum_type`, documented below.
- `checksum_type` (string) - The type of the checksum specified in `checksum`.
Valid values are `none`, `md5`, `sha1`, `sha256`, or `sha512`. Although the
checksum will not be verified when `checksum_type` is set to "none", this is
not recommended since OVA files can be very large and corruption does happen
from time to time.
- `template` (string) - a path to a golang template for a
vagrantfile. Our default template can be found
[here](https://github.com/hashicorp/packer/blob/master/builder/vagrant/step_create_vagrantfile.go#L23-L37). So far the only template variables available to you are {{ .BoxName }} and
{{ .SyncedFolder }}, which correspond to the Packer options `box_name` and
`synced_folder`.
You must provide a template if your default vagrant provider is Hyper-V.
Below is a Hyper-V compatible template.
```ruby
Vagrant.configure("2") do |config|
config.vm.box = "{{ .BoxName }}"
config.vm.network 'public_network', bridge: 'Default Switch'
end
```
- `skip_add` (bool) - Don't call "vagrant add" to add the box to your local
environment; this is necessary if you want to launch a box that is already
added to your vagrant environment.
- `teardown_method` (string) - Whether to halt, suspend, or destroy the box when
the build has completed. Defaults to "halt"
- `box_version` (string) - What box version to use when initializing Vagrant.
- `add_cacert` (string) - Equivalent to setting the
[`--cacert`](https://www.vagrantup.com/docs/cli/box.html#cacert-certfile)
option in `vagrant add`; defaults to unset.
- `add_capath` (string) - Equivalent to setting the
[`--capath`](https://www.vagrantup.com/docs/cli/box.html#capath-certdir) option
in `vagrant add`; defaults to unset.
- `add_cert` (string) - Equivalent to setting the
[`--cert`](https://www.vagrantup.com/docs/cli/box.html#cert-certfile) option in
`vagrant add`; defaults to unset.
- `add_clean` (bool) - Equivalent to setting the
[`--clean`](https://www.vagrantup.com/docs/cli/box.html#clean) flag in
`vagrant add`; defaults to unset.
- `add_force` (bool) - Equivalent to setting the
[`--force`](https://www.vagrantup.com/docs/cli/box.html#force) flag in
`vagrant add`; defaults to unset.
- `add_insecure` (bool) - Equivalent to setting the
[`--insecure`](https://www.vagrantup.com/docs/cli/box.html#insecure) flag in
`vagrant add`; defaults to unset.
- `skip_package` (bool) - if true, Packer will not call `vagrant package` to
package your base box into its own standalone .box file.
- `output_vagrantfile` (string) - Equivalent to setting the
[`--vagrantfile`](https://www.vagrantup.com/docs/cli/package.html#vagrantfile-file) option
in `vagrant package`; defaults to unset
- `package_include` (string) - Equivalent to setting the
[`--include`](https://www.vagrantup.com/docs/cli/package.html#include-x-y-z) option
in `vagrant package`; defaults to unset
## Example
Sample for `hashicorp/precise64` with virtualbox provider.
```json
{
"builders": [
{
"communicator": "ssh",
"source_path": "hashicorp/precise64",
"provider": "virtualbox",
"add_force": true,
"type": "vagrant"
}
]
}
```
## A note on SSH connections
Currently this builder only works for SSH connections, and automatically fills
in all information needed for the ssh communicator using vagrant's ssh-config.
If you would like to connect via a different username or authentication method
than is produced when you call `vagrant ssh-config`, then you must provide the
`ssh_username` and all other relevant authentication information (e.g.
`ssh_password` or `ssh_private_key_file`)
By providing the `ssh_username`, you're telling Packer not to use the vagrant
ssh config, except for determining the host and port for the virtual machine to
connect to.

View File

@ -2,11 +2,11 @@
modeline: |
vim: set ft=pandoc:
description: |
The VirtualBox Packer builder is able to create VirtualBox virtual machines
and export them in the OVF format, starting from an ISO image.
The VirtualBox Packer builder is able to create VirtualBox virtual machines
and export them in the OVF format, starting from an ISO image.
layout: docs
page_title: 'VirtualBox ISO - Builders'
sidebar_current: 'docs-builders-virtualbox-iso'
page_title: VirtualBox ISO - Builders
sidebar_current: docs-builders-virtualbox-iso
---
# VirtualBox Builder (from an ISO)
@ -60,95 +60,95 @@ references for [ISO](#iso-configuration),
configuration references, which are
necessary for this build to succeed and can be found further down the page.
#### Optional:
<%= partial "partials/builder/virtualbox/iso/Config-not-required" %>
<%= partial "partials/builder/virtualbox/common/VBoxVersionConfig-not-required" %>
<%= partial "partials/builder/virtualbox/common/VBoxBundleConfig-not-required" %>
<%= partial "partials/builder/virtualbox/common/GuestAdditionsConfig-not-required" %>
@include 'partials/builder/virtualbox/iso/Config-not-required.mdx'
@include 'partials/builder/virtualbox/common/VBoxVersionConfig-not-required.mdx'
@include 'partials/builder/virtualbox/common/VBoxBundleConfig-not-required.mdx'
@include 'partials/builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx'
### ISO Configuration
<%= partial "partials/common/ISOConfig" %>
@include 'partials/common/ISOConfig.mdx'
#### Required:
<%= partial "partials/common/ISOConfig-required" %>
@include 'partials/common/ISOConfig-required.mdx'
#### Optional:
<%= partial "partials/common/ISOConfig-not-required" %>
@include 'partials/common/ISOConfig-not-required.mdx'
### Http directory configuration
<%= partial "partials/common/HTTPConfig" %>
@include 'partials/common/HTTPConfig.mdx'
#### Optional:
<%= partial "partials/common/HTTPConfig-not-required" %>
@include 'partials/common/HTTPConfig-not-required.mdx'
### Floppy configuration
<%= partial "partials/common/FloppyConfig" %>
@include 'partials/common/FloppyConfig.mdx'
#### Optional:
<%= partial "partials/common/FloppyConfig-not-required" %>
@include 'partials/common/FloppyConfig-not-required.mdx'
### Export configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/ExportConfig-not-required" %>
@include 'partials/builder/virtualbox/common/ExportConfig-not-required.mdx'
### Output configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/OutputConfig-not-required" %>
@include 'partials/builder/virtualbox/common/OutputConfig-not-required.mdx'
### Run configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/RunConfig-not-required" %>
@include 'partials/builder/virtualbox/common/RunConfig-not-required.mdx'
### Shutdown configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/ShutdownConfig-not-required" %>
@include 'partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx'
### Hardware configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/HWConfig-not-required" %>
@include 'partials/builder/virtualbox/common/HWConfig-not-required.mdx'
### VBox Manage configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/VBoxManageConfig-not-required" %>
@include 'partials/builder/virtualbox/common/VBoxManageConfig-not-required.mdx'
### Communicator configuration
#### Optional common fields:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/builder/virtualbox/common/CommConfig-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/builder/virtualbox/common/CommConfig-not-required.mdx'
#### Optional SSH fields:
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/SSH-not-required.mdx'
#### Optional WinRM fields:
<%= partial "partials/helper/communicator/WinRM-not-required" %>
@include 'partials/helper/communicator/WinRM-not-required.mdx'
### Boot Configuration
<%= partial "partials/common/bootcommand/BootConfig" %>
@include 'partials/common/bootcommand/BootConfig.mdx'
The boot command is sent to the VM through the `VBoxManage` utility in as few
invocations as possible. We send each character in groups of 25, with a default
@ -170,16 +170,16 @@ contention. If you notice missing keys, you can tune this delay by specifying
#### Optional:
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
@include 'partials/common/bootcommand/BootConfig-not-required.mdx'
<%= partial "partials/builders/boot-command" %>
@include 'partials/builders/boot-command.mdx'
<%= partial "partials/builders/virtualbox-ssh-key-pair" %>
@include 'partials/builders/virtualbox-ssh-key-pair.mdx'
Example boot command. This is actually a working boot command used to start an
Ubuntu 12.04 installer:
``` text
```text
[
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
@ -229,9 +229,7 @@ section. An example is shown below that sets the VRAM within the virtual machine
```json
{
"vboxmanage": [
["modifyvm", "{{.Name}}", "--vram", "64"]
]
"vboxmanage": [["modifyvm", "{{.Name}}", "--vram", "64"]]
}
```
@ -255,4 +253,4 @@ to "sata". Otherwise your attached drive will not be bootable. Example:
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--firmware", "EFI" ]
]
```
```

View File

@ -2,12 +2,12 @@
modeline: |
vim: set ft=pandoc:
description: |
This VirtualBox Packer builder is able to create VirtualBox virtual machines
and export them in the OVF format, starting from an existing OVF/OVA (exported
virtual machine image).
This VirtualBox Packer builder is able to create VirtualBox virtual machines
and export them in the OVF format, starting from an existing OVF/OVA (exported
virtual machine image).
layout: docs
page_title: 'VirtualBox OVF/OVA - Builders'
sidebar_current: 'docs-builders-virtualbox-ovf'
page_title: VirtualBox OVF/OVA - Builders
sidebar_current: docs-builders-virtualbox-ovf
---
# VirtualBox Builder (from an OVF/OVA)
@ -54,7 +54,6 @@ provisioner might not be saved.
## Configuration Reference
There are many configuration options available for the builder. In addition to
the items listed here, you will want to look at the general configuration
references for [ISO](#iso-configuration),
@ -70,75 +69,76 @@ necessary for this build to succeed and can be found further down the page.
### Required:
<%= partial "partials/builder/virtualbox/ovf/Config-required" %>
@include 'partials/builder/virtualbox/ovf/Config-required.mdx'
#### Optional:
<%= partial "partials/builder/virtualbox/ovf/Config-not-required" %>
<%= partial "partials/builder/virtualbox/common/VBoxVersionConfig-not-required" %>
<%= partial "partials/builder/virtualbox/common/GuestAdditionsConfig-not-required" %>
@include 'partials/builder/virtualbox/ovf/Config-not-required.mdx'
@include 'partials/builder/virtualbox/common/VBoxVersionConfig-not-required.mdx'
@include 'partials/builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx'
### VBoxManage configuration
<%= partial "partials/builder/virtualbox/common/VBoxManageConfig-not-required" %>
@include 'partials/builder/virtualbox/common/VBoxManageConfig-not-required.mdx'
### Http directory configuration
<%= partial "partials/common/HTTPConfig" %>
@include 'partials/common/HTTPConfig.mdx'
#### Optional:
<%= partial "partials/common/HTTPConfig-not-required" %>
@include 'partials/common/HTTPConfig-not-required.mdx'
### Floppy configuration
<%= partial "partials/common/FloppyConfig" %>
@include 'partials/common/FloppyConfig.mdx'
#### Optional:
<%= partial "partials/common/FloppyConfig-not-required" %>
@include 'partials/common/FloppyConfig-not-required.mdx'
### Export configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/ExportConfig-not-required" %>
@include 'partials/builder/virtualbox/common/ExportConfig-not-required.mdx'
### Output configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/OutputConfig-not-required" %>
@include 'partials/builder/virtualbox/common/OutputConfig-not-required.mdx'
### Run configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/RunConfig-not-required" %>
@include 'partials/builder/virtualbox/common/RunConfig-not-required.mdx'
### Shutdown configuration
#### Optional:
<%= partial "partials/builder/virtualbox/common/ShutdownConfig-not-required" %>
@include 'partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx'
### Communicator configuration
#### Optional common fields:
<%= partial "partials/helper/communicator/Config-not-required" %>
<%= partial "partials/builder/virtualbox/common/CommConfig-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
@include 'partials/builder/virtualbox/common/CommConfig-not-required.mdx'
#### Optional SSH fields:
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/SSH-not-required.mdx'
#### Optional WinRM fields:
<%= partial "partials/helper/communicator/WinRM-not-required" %>
@include 'partials/helper/communicator/WinRM-not-required.mdx'
### Boot Configuration
<%= partial "partials/common/bootcommand/BootConfig" %>
@include 'partials/common/bootcommand/BootConfig.mdx'
The boot command is sent to the VM through the `VBoxManage` utility in as few
invocations as possible. We send each character in groups of 25, with a default
@ -160,16 +160,16 @@ contention. If you notice missing keys, you can tune this delay by specifying
#### Optional:
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
@include 'partials/common/bootcommand/BootConfig-not-required.mdx'
<%= partial "partials/builders/boot-command" %>
@include 'partials/builders/boot-command.mdx'
<%= partial "partials/builders/virtualbox-ssh-key-pair" %>
@include 'partials/builders/virtualbox-ssh-key-pair.mdx'
Example boot command. This is actually a working boot command used to start an
Ubuntu 12.04 installer:
``` text
```text
[
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",

View File

@ -0,0 +1,377 @@
---
modeline: |
vim: set ft=pandoc:
description: >
The VirtualBox Packer builder is able to create VirtualBox virtual machines
snapshots
and export them in the OVF format, starting from an ISO image.
layout: docs
page_title: VirtualBox Snapshot - Builders
sidebar_current: docs-builders-virtualbox-vm
---
# VirtualBox Builder (from an existing VM)
Type: `virtualbox-vm`
The VirtualBox Packer builder is able to create
[VirtualBox](https://www.virtualbox.org/) virtual machines snapshots and
(optionally) export them in the OVF format, starting from an **existing**
virtual machine.
The builder builds a virtual machine snapshot by using an existing virtual
machine, booting it, provisioning software within the OS, then shutting it down.
The result of the VirtualBox builder is a new snapshot persisting all changes
from the applied provisioners.
## Basic Example
Here is a basic example. which serves to show the basic configuration:
```json
{
"type": "virtualbox-vm",
"communicator": "winrm",
"headless": "{{user `headless`}}",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_additions_mode": "disable",
"output_directory": "./builds-vm",
"vm_name": "target-vm",
"attach_snapshot": "Snapshot",
"target_snapshot": "Target-Snapshot",
"force_delete_snapshot": "true",
"keep_registered": "false",
"skip_export": "false"
}
```
It is important to add a `shutdown_command`. By default Packer halts the virtual
machine and the file system may not be sync'd. Thus, changes made in a
provisioner might not be saved.
## Configuration Reference
There are many configuration options available for the VirtualBox builder. They
are organized below into two categories: required and optional. Within each
category, the available options are alphabetized and described.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
- `vm_name` (string) - This is the name of the virtual machine to which the
builder shall attach.
### Optional:
- `attach_snapshot` (string) - Default to `null/empty`. The name of an
**existing** snapshot to which the builder shall attach the VM before
starting it. If no snapshot is specified the builder will simply start the
VM from it's current state i.e. snapshot.
- `boot_command` (array of strings) - This is an array of commands to type
when the virtual machine is first booted. The goal of these commands should
be to type just enough to initialize the operating system installer. Special
keys can be typed as well, and are covered in the section below on the
boot command. If this is not specified, it is assumed the installer will
start itself.
- `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be
a duration. Examples are `5s` and `1m30s` which will cause Packer to wait
five seconds and one minute 30 seconds, respectively. If this isn't
specified, the default is `10s` or 10 seconds.
- `export_opts` (array of strings) - Additional options to pass to the
[VBoxManage
export](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export). This
can be useful for passing product information to include in the resulting
appliance file. Packer JSON configuration file example:
```json
{
"type": "virtualbox-vm",
"export_opts": [
"--manifest",
"--vsys",
"0",
"--description",
"{{user `vm_description`}}",
"--version",
"{{user `vm_version`}}"
],
"format": "ova"
}
```
A VirtualBox [VM
description](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export-ovf)
may contain arbitrary strings; the GUI interprets HTML formatting. However,
the JSON format does not allow arbitrary newlines within a value. Add a
multi-line description by preparing the string in the shell before the
packer call like this (shell `>` continuation character snipped for easier
copy & paste):
```{.shell}
vm_description='some
multiline
description'
vm_version='0.2.0'
packer build \
-var "vm_description=${vm_description}" \
-var "vm_version=${vm_version}" \
"packer_conf.json"
```
- `floppy_dirs` (array of strings) - A list of directories to place onto
the floppy disk recursively. This is similar to the `floppy_files` option
except that the directory structure is preserved. This is useful for when
your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed.
- `floppy_files` (array of strings) - A list of files to place onto a floppy
disk that is attached when the VM is booted. This is most useful for
unattended Windows installs, which look for an `Autounattend.xml` file on
removable media. By default, no floppy will be attached. All files listed in
this setting get placed into the root directory of the floppy and the floppy
is attached as the first floppy device. Currently, no support exists for
creating sub-directories on the floppy. Wildcard characters (\*, ?,
and \[\]) are allowed. Directory names are also allowed, which will add all
the files found in the directory to the floppy.
- `force_delete_snapshot` (boolean) - Defaults to `false`. If set to `true`,
overwrite an existing `target_snapshot`. Otherwise the builder will yield an
error if the specified target snapshot already exists.
- `format` (string) - Either `ovf` or `ova`, this specifies the output format
of the exported virtual machine. This defaults to `ovf`.
- `guest_additions_interface` (string) - The interface type to use to mount
guest additions when `guest_additions_mode` is set to `attach`. Will
default to the value set in `iso_interface`, if `iso_interface` is set.
Will default to "ide", if `iso_interface` is not set. Options are "ide" and
"sata".
- `guest_additions_mode` (string) - The method by which guest additions are
made available to the guest for installation. Valid options are `upload`,
`attach`, or `disable`. If the mode is `attach` the guest additions ISO will
be attached as a CD device to the virtual machine. If the mode is `upload`
the guest additions ISO will be uploaded to the path specified by
`guest_additions_path`. The default value is `upload`. If `disable` is used,
guest additions won't be downloaded, either.
- `guest_additions_path` (string) - The path on the guest virtual machine
where the VirtualBox guest additions ISO will be uploaded. By default this
is `VBoxGuestAdditions.iso` which should upload into the login directory of
the user. This is a [configuration
template](/docs/templates/engine.html) where the `Version`
variable is replaced with the VirtualBox version.
- `guest_additions_sha256` (string) - The SHA256 checksum of the guest
additions ISO that will be uploaded to the guest VM. By default the
checksums will be downloaded from the VirtualBox website, so this only needs
to be set if you want to be explicit about the checksum.
- `guest_additions_url` (string) - The URL to the guest additions ISO
to upload. This can also be a file URL if the ISO is at a local path. By
default, the VirtualBox builder will attempt to find the guest additions ISO
on the local file system. If it is not available locally, the builder will
download the proper guest additions ISO from the internet.
- `guest_os_type` (string) - The guest OS type being installed. By default
this is `other`, but you can get _dramatic_ performance improvements by
setting this to the proper value. To view all available values for this run
`VBoxManage list ostypes`. Setting the correct value hints to VirtualBox how
to optimize the virtual hardware to work best with that operating system.
- `headless` (boolean) - Packer defaults to building VirtualBox virtual
machines by launching a GUI that shows the console of the machine
being built. When this value is set to `true`, the machine will start
without a console.
- `http_directory` (string) - Path to a directory to serve using an
HTTP server. The files in this directory will be available over HTTP that
will be requestable from the virtual machine. This is useful for hosting
kickstart files and so on. By default this is an empty string, which means
no HTTP server will be started. The address and port of the HTTP server will
be available as variables in `boot_command`. This is covered in more detail
below.
- `http_port_min` and `http_port_max` (number) - These are the minimum and
maximum port to use for the HTTP server started to serve the
`http_directory`. Because Packer often runs in parallel, Packer will choose
a randomly available port in this range to run the HTTP server. If you want
to force the HTTP server to be on one port, make this minimum and maximum
port the same. By default the values are `8000` and `9000`, respectively.
- `keep_registered` (boolean) - Set this to `true` if you would like to keep
the VM attached to the snapshot specified by `attach_snapshot`. Otherwise
the builder will reset the VM to the snapshot to which the VM was attached
before the builder started. Defaults to `false`.
- `output_directory` (string) - This is the path to the directory where the
resulting virtual machine will be created. This may be relative or absolute.
If relative, the path is relative to the working directory when `packer`
is executed. This directory must not exist or be empty prior to running
the builder. By default this is `output-BUILDNAME` where "BUILDNAME" is the
name of the build.
- `skip_export` (boolean) - Defaults to `false`. When enabled, Packer will
not export the VM. Useful if the builder should be applied again on the created
target snapshot.
@include 'partials/builder/virtualbox/common/CommConfig-not-required.mdx'
- `target_snapshot` (string) - Default to `null/empty`. The name of the
snapshot which shall be created after all provisioners has been run by the
builder. If no target snapshot is specified and `keep_registered` is set to
`false` the builder will revert to the snapshot to which the VM was attached
before the builder has been executed, which will revert all changes applied
by the provisioners. This is handy if only an export shall be created and no
further snapshot is required.
- `vboxmanage` (array of array of strings) - Custom `VBoxManage` commands to
execute in order to further customize the virtual machine being created. The
value of this is an array of commands to execute. The commands are executed
in the order defined in the template. For each command, the command is
defined itself as an array of strings, where each string represents a single
argument on the command-line to `VBoxManage` (but excluding
`VBoxManage` itself). Each arg is treated as a [configuration
template](/docs/templates/engine.html), where the `Name`
variable is replaced with the VM name. More details on how to use
`VBoxManage` are below.
- `vboxmanage_post` (array of array of strings) - Identical to `vboxmanage`,
except that it is run after the virtual machine is shutdown, and before the
virtual machine is exported.
- `virtualbox_version_file` (string) - The path within the virtual machine to
upload a file that contains the VirtualBox version that was used to create
the machine. This information can be useful for provisioning. By default
this is `.vbox_version`, which will generally be uploaded into the home
directory. Set to an empty string to skip uploading this file, which can be
useful when using the `none` communicator.
- `vrdp_bind_address` (string / IP address) - The IP address that should be
binded to for VRDP. By default packer will use `127.0.0.1` for this. If you
wish to bind to all interfaces use `0.0.0.0`.
- `vrdp_port_min` and `vrdp_port_max` (number) - The minimum and maximum port
to use for VRDP access to the virtual machine. Packer uses a randomly chosen
port in this range that appears available. By default this is `5900` to
`6000`. The minimum and maximum ports are inclusive.
### Shutdown configuration
#### Optional:
@include 'partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx'
## Boot Command
The `boot_command` configuration is very important: it specifies the keys to
type when the virtual machine is first booted in order to start the OS
installer. This command is typed after `boot_wait`, which gives the virtual
machine some time to actually load the ISO.
As documented above, the `boot_command` is an array of strings. The strings are
all typed in sequence. It is an array only to improve readability within the
template.
The boot command is sent to the VM through the `VBoxManage` utility in as few
invocations as possible. We send each character in groups of 25, with a default
delay of 100ms between groups. The delay alleviates issues with latency and CPU
contention. If you notice missing keys, you can tune this delay by specifying
"boot_keygroup_interval" in your Packer template, for example:
```json
{
"builders": [
{
"type": "virtualbox",
"boot_keygroup_interval": "500ms"
...
}
]
}
```
@include 'partials/builders/boot-command.mdx'
@include 'partials/builders/virtualbox-ssh-key-pair.mdx'
Example boot command. This is actually a working boot command used to start an
Ubuntu 12.04 installer:
```text
[
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{ .Name }} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- <enter>"
]
```
Please note that for the Virtuabox builder, the IP address of the HTTP server
Packer launches for you to access files like the preseed file in the example
above (`{{ .HTTPIP }}`) is hardcoded to 10.0.2.2. If you change the network
of your VM you must guarantee that you can still access this HTTP server.
For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools.html#templates).
## Guest Additions
Packer will automatically download the proper guest additions for the version of
VirtualBox that is running and upload those guest additions into the virtual
machine so that provisioners can easily install them.
Packer downloads the guest additions from the official VirtualBox website, and
verifies the file with the official checksums released by VirtualBox.
After the virtual machine is up and the operating system is installed, Packer
uploads the guest additions into the virtual machine. The path where they are
uploaded is controllable by `guest_additions_path`, and defaults to
"VBoxGuestAdditions.iso". Without an absolute path, it is uploaded to the home
directory of the SSH user.
## VBoxManage Commands
In order to perform extra customization of the virtual machine, a template can
define extra calls to `VBoxManage` to perform.
[VBoxManage](https://www.virtualbox.org/manual/ch09.html) is the command-line
interface to VirtualBox where you can completely control VirtualBox. It can be
used to do things such as set RAM, CPUs, etc.
Extra VBoxManage commands are defined in the template in the `vboxmanage`
section. An example is shown below that sets the VRAM within the virtual machine:
```json
{
"vboxmanage": [["modifyvm", "{{.Name}}", "--vram", "64"]]
}
```
The value of `vboxmanage` is an array of commands to execute. These commands are
executed in the order defined. So in the above example, the memory will be set
followed by the CPUs.
Each command itself is an array of strings, where each string is an argument to
`VBoxManage`. Each argument is treated as a [configuration
template](/docs/templates/engine.html). The only available
variable is `Name` which is replaced with the unique name of the VM, which is
required for many VBoxManage calls.

View File

@ -0,0 +1,39 @@
---
description: >
The VirtualBox Packer builder is able to create VirtualBox virtual machines
and
export them in the OVA or OVF format.
layout: docs
page_title: VirtualBox - Builders
sidebar_current: docs-builders-virtualbox
---
# VirtualBox Builder
The VirtualBox Packer builder is able to create
[VirtualBox](https://www.virtualbox.org) virtual machines and export them in
the OVA or OVF format.
Packer actually comes with multiple builders able to create VirtualBox
machines, depending on the strategy you want to use to build the image. Packer
supports the following VirtualBox builders:
- [virtualbox-iso](/docs/builders/virtualbox-iso.html) - Starts from an ISO
file, creates a brand new VirtualBox VM, installs an OS, provisions
software within the OS, then exports that machine to create an image. This
is best for people who want to start from scratch.
- [virtualbox-ovf](/docs/builders/virtualbox-ovf.html) - This builder imports
an existing OVF/OVA file, runs provisioners on top of that VM, and exports
that machine to create an image. This is best if you have an existing
VirtualBox VM export you want to use as the source. As an additional
benefit, you can feed the artifact of this builder back into itself to
iterate on a machine.
- [virtualbox-vm](/docs/builders/virtualbox-vm.html) - This builder uses an
existing VM to run defined provisioners on top of that VM, and optionally
creates a snapshot to save the changes applied from the provisioners. In
addition the builder is able to export that machine to create an image. The
builder is able to attach to a defined snapshot as a starting point, which
could be defined statically or dynamically via a variable.

View File

@ -2,14 +2,14 @@
modeline: |
vim: set ft=pandoc:
description: |
This VMware Packer builder is able to create VMware virtual machines from an
ISO file as a source. It currently supports building virtual machines on hosts
running VMware Fusion for OS X, VMware Workstation for Linux and Windows, and
VMware Player on Linux. It can also build machines directly on VMware vSphere
Hypervisor using SSH as opposed to the vSphere API.
This VMware Packer builder is able to create VMware virtual machines from an
ISO file as a source. It currently supports building virtual machines on hosts
running VMware Fusion for OS X, VMware Workstation for Linux and Windows, and
VMware Player on Linux. It can also build machines directly on VMware vSphere
Hypervisor using SSH as opposed to the vSphere API.
layout: docs
page_title: 'VMware ISO - Builders'
sidebar_current: 'docs-builders-vmware-iso'
page_title: VMware ISO - Builders
sidebar_current: docs-builders-vmware-iso
---
# VMware Builder (from ISO)
@ -69,104 +69,104 @@ references for [ISO](#iso-configuration),
configuration references, which are
necessary for this build to succeed and can be found further down the page.
#### Optional:
<%= partial "partials/builder/vmware/iso/Config-not-required" %>
@include 'partials/builder/vmware/iso/Config-not-required.mdx'
### ISO Configuration
<%= partial "partials/common/ISOConfig" %>
@include 'partials/common/ISOConfig.mdx'
#### Required:
<%= partial "partials/common/ISOConfig-required" %>
@include 'partials/common/ISOConfig-required.mdx'
#### Optional:
<%= partial "partials/common/ISOConfig-not-required" %>
@include 'partials/common/ISOConfig-not-required.mdx'
### Http directory configuration
<%= partial "partials/common/HTTPConfig" %>
@include 'partials/common/HTTPConfig.mdx'
#### Optional:
<%= partial "partials/common/HTTPConfig-not-required" %>
@include 'partials/common/HTTPConfig-not-required.mdx'
### Floppy configuration
<%= partial "partials/common/FloppyConfig" %>
@include 'partials/common/FloppyConfig.mdx'
#### Optional:
<%= partial "partials/common/FloppyConfig-not-required" %>
@include 'partials/common/FloppyConfig-not-required.mdx'
### Shutdown configuration
#### Optional:
<%= partial "partials/common/shutdowncommand/ShutdownConfig-not-required" %>
@include 'partials/common/shutdowncommand/ShutdownConfig-not-required.mdx'
### Driver configuration
#### Optional:
<%= partial "partials/builder/vmware/common/DriverConfig-not-required" %>
@include 'partials/builder/vmware/common/DriverConfig-not-required.mdx'
### Hardware configuration
#### Optional:
<%= partial "partials/builder/vmware/common/HWConfig-not-required" %>
@include 'partials/builder/vmware/common/HWConfig-not-required.mdx'
### Output configuration
#### Optional:
<%= partial "partials/builder/vmware/common/OutputConfig-not-required" %>
@include 'partials/builder/vmware/common/OutputConfig-not-required.mdx'
### Run configuration
#### Optional:
<%= partial "partials/builder/vmware/common/RunConfig-not-required" %>
@include 'partials/builder/vmware/common/RunConfig-not-required.mdx'
### Tools configuration
#### Optional:
<%= partial "partials/builder/vmware/common/ToolsConfig-not-required" %>
@include 'partials/builder/vmware/common/ToolsConfig-not-required.mdx'
### VMX configuration
#### Optional:
<%= partial "partials/builder/vmware/common/VMXConfig-not-required" %>
@include 'partials/builder/vmware/common/VMXConfig-not-required.mdx'
### Export configuration
#### Optional:
<%= partial "partials/builder/vmware/common/ExportConfig-not-required" %>
@include 'partials/builder/vmware/common/ExportConfig-not-required.mdx'
### Communicator configuration
#### Optional common fields:
<%= partial "partials/helper/communicator/Config-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
#### Optional SSH fields:
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/SSH-not-required.mdx'
#### Optional WinRM fields:
<%= partial "partials/helper/communicator/WinRM-not-required" %>
@include 'partials/helper/communicator/WinRM-not-required.mdx'
## Boot Configuration
<%= partial "partials/common/bootcommand/BootConfig" %>
<%= partial "partials/common/bootcommand/VNCConfig" %>
@include 'partials/common/bootcommand/BootConfig.mdx'
@include 'partials/common/bootcommand/VNCConfig.mdx'
-&gt; **Note**: for the `HTTPIP` to be resolved correctly, your VM's network
configuration has to include a `hostonly` or `nat` type network interface.
@ -176,8 +176,8 @@ to modify the network configuration after the VM is done building.
#### Optional:
<%= partial "partials/common/bootcommand/VNCConfig-not-required" %>
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
@include 'partials/common/bootcommand/VNCConfig-not-required.mdx'
@include 'partials/common/bootcommand/BootConfig-not-required.mdx'
For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools.html#templates).
@ -199,14 +199,14 @@ Within the template, a handful of variables are available so that your template
can continue working with the rest of the Packer machinery. Using these
variables isn't required, however.
- `Name` - The name of the virtual machine.
- `GuestOS` - The VMware-valid guest OS type.
- `DiskName` - The filename (without the suffix) of the main virtual disk.
- `ISOPath` - The path to the ISO to use for the OS installation.
- `Version` - The Hardware version VMWare will execute this vm under. Also
known as the `virtualhw.version`.
- `Name` - The name of the virtual machine.
- `GuestOS` - The VMware-valid guest OS type.
- `DiskName` - The filename (without the suffix) of the main virtual disk.
- `ISOPath` - The path to the ISO to use for the OS installation.
- `Version` - The Hardware version VMWare will execute this vm under. Also
known as the `virtualhw.version`.
<%= partial "partials/builders/building_on_remote_vsphere_hypervisor" %>
@include 'partials/builders/building_on_remote_vsphere_hypervisor.mdx'
### VNC port discovery
@ -232,10 +232,8 @@ file by attaching a floppy disk. An example below, based on RHEL:
{
"builders": [
{
"type":"vmware-iso",
"floppy_files": [
"folder/ks.cfg"
],
"type": "vmware-iso",
"floppy_files": ["folder/ks.cfg"],
"boot_command": "<tab> text ks=floppy <enter><wait>"
}
]
@ -250,10 +248,8 @@ a different syntax to source a kickstart file from a mounted floppy image.
{
"builders": [
{
"type":"vmware-iso",
"floppy_files": [
"folder/ks.cfg"
],
"type": "vmware-iso",
"floppy_files": ["folder/ks.cfg"],
"boot_command": "<tab> inst.text inst.ks=hd:fd0:/ks.cfg <enter><wait>"
}
]

View File

@ -2,13 +2,13 @@
modeline: |
vim: set ft=pandoc:
description: |
This VMware Packer builder is able to create VMware virtual machines from an
existing VMware virtual machine (a VMX file). It currently supports building
virtual machines on hosts running VMware Fusion Professional for OS X, VMware
Workstation for Linux and Windows, and VMware Player on Linux.
This VMware Packer builder is able to create VMware virtual machines from an
existing VMware virtual machine (a VMX file). It currently supports building
virtual machines on hosts running VMware Fusion Professional for OS X, VMware
Workstation for Linux and Windows, and VMware Player on Linux.
layout: docs
page_title: 'VMware VMX - Builders'
sidebar_current: 'docs-builders-vmware-vmx'
page_title: VMware VMX - Builders
sidebar_current: docs-builders-vmware-vmx
---
# VMware Builder (from VMX)
@ -54,7 +54,6 @@ In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
## Configuration Reference
There are many configuration options available for the builder. In addition to
@ -76,85 +75,86 @@ necessary for this build to succeed and can be found further down the page.
### Required:
<%= partial "partials/builder/vmware/vmx/Config-required" %>
@include 'partials/builder/vmware/vmx/Config-required.mdx'
#### Optional:
<%= partial "partials/builder/vmware/vmx/Config-not-required" %>
@include 'partials/builder/vmware/vmx/Config-not-required.mdx'
### Http directory configuration
<%= partial "partials/common/HTTPConfig" %>
@include 'partials/common/HTTPConfig.mdx'
#### Optional:
<%= partial "partials/common/HTTPConfig-not-required" %>
@include 'partials/common/HTTPConfig-not-required.mdx'
### Floppy configuration
<%= partial "partials/common/FloppyConfig" %>
@include 'partials/common/FloppyConfig.mdx'
#### Optional:
<%= partial "partials/common/FloppyConfig-not-required" %>
@include 'partials/common/FloppyConfig-not-required.mdx'
### Export configuration
#### Optional:
<%= partial "partials/builder/vmware/common/ExportConfig-not-required" %>
@include 'partials/builder/vmware/common/ExportConfig-not-required.mdx'
### Output configuration
#### Optional:
<%= partial "partials/builder/vmware/common/OutputConfig-not-required" %>
@include 'partials/builder/vmware/common/OutputConfig-not-required.mdx'
### Run configuration
#### Optional:
<%= partial "partials/builder/vmware/common/RunConfig-not-required" %>
@include 'partials/builder/vmware/common/RunConfig-not-required.mdx'
### Driver configuration
#### Optional:
<%= partial "partials/builder/vmware/common/DriverConfig-not-required" %>
@include 'partials/builder/vmware/common/DriverConfig-not-required.mdx'
### Tools configuration
#### Optional:
<%= partial "partials/builder/vmware/common/ToolsConfig-not-required" %>
@include 'partials/builder/vmware/common/ToolsConfig-not-required.mdx'
### VMX configuration
#### Optional:
<%= partial "partials/builder/vmware/common/VMXConfig-not-required" %>
@include 'partials/builder/vmware/common/VMXConfig-not-required.mdx'
### Communicator configuration
#### Optional common fields:
<%= partial "partials/helper/communicator/Config-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
#### Optional SSH fields:
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/SSH-not-required.mdx'
#### Optional WinRM fields:
<%= partial "partials/helper/communicator/WinRM-not-required" %>
@include 'partials/helper/communicator/WinRM-not-required.mdx'
## Shutdown Configuration
<%= partial "partials/common/shutdowncommand/ShutdownConfig-not-required" %>
@include 'partials/common/shutdowncommand/ShutdownConfig-not-required.mdx'
## Boot Configuration
<%= partial "partials/common/bootcommand/BootConfig" %>
<%= partial "partials/common/bootcommand/VNCConfig" %>
@include 'partials/common/bootcommand/BootConfig.mdx'
@include 'partials/common/bootcommand/VNCConfig.mdx'
-&gt; **Note**: for the `HTTPIP` to be resolved correctly, your VM's network
configuration has to include a `hostonly` or `nat` type network interface.
@ -164,8 +164,8 @@ to modify the network configuration after the VM is done building.
#### Optional:
<%= partial "partials/common/bootcommand/VNCConfig-not-required" %>
<%= partial "partials/common/bootcommand/BootConfig-not-required" %>
@include 'partials/common/bootcommand/VNCConfig-not-required.mdx'
@include 'partials/common/bootcommand/BootConfig-not-required.mdx'
For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools.html#templates).
@ -185,7 +185,7 @@ For more examples of various boot commands, see the sample projects from our
Example boot command. This is actually a working boot command used to start an
Ubuntu 12.04 installer:
``` text
```text
[
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
@ -202,4 +202,4 @@ Ubuntu 12.04 installer:
For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools.html#templates).
<%= partial "partials/builders/building_on_remote_vsphere_hypervisor" %>
@include 'partials/builders/building_on_remote_vsphere_hypervisor.mdx'

View File

@ -0,0 +1,40 @@
---
description: |
The VMware Packer builder is able to create VMware virtual machines for use
with any VMware product.
layout: docs
page_title: VMware - Builders
sidebar_current: docs-builders-vmware
---
# VMware Builder
The VMware Packer builder is able to create VMware virtual machines for use
with any VMware product.
Packer actually comes with multiple builders able to create VMware machines,
depending on the strategy you want to use to build the image. Packer supports
the following VMware builders:
- [vmware-iso](/docs/builders/vmware-iso.html) - Starts from an ISO file,
creates a brand new VMware VM, installs an OS, provisions software within
the OS, then exports that machine to create an image. This is best for
people who want to start from scratch.
- [vmware-vmx](/docs/builders/vmware-vmx.html) - This builder imports an
existing VMware machine (from a VMX file), runs provisioners on top of that
VM, and exports that machine to create an image. This is best if you have
an existing VMware VM you want to use as the source. As an additional
benefit, you can feed the artifact of this builder back into Packer to
iterate on a machine.
- [vsphere-iso](/docs/builders/vsphere-iso.html) - This builder starts from an
ISO file, but utilizes the vSphere API rather than the esxcli to build on a
remote esx instance. This allows you to build vms even if you do not have
SSH access to your vSphere cluster.
- [vsphere-clone](/docs/builders/vsphere-clone.html) - This builder clones a
vm from an existing template, then modifies it and saves it as a new
template. It uses the vSphere API rather than the esxcli to build on a
remote esx instance. This allows you to build vms even if you do not have
SSH access to your vSphere cluster.

View File

@ -0,0 +1,175 @@
---
modeline: |
vim: set ft=pandoc:
description: |
This VMware Packer builder uses the vSphere API to clone an existing vSphere template and create a new virtual machine remotely.
layout: docs
page_title: 'VSphere Clone - Builders'
sidebar_current: 'docs-builders-vsphere-clone'
---
# VMWare Vsphere Clone Builder
Type: `vsphere-clone`
This builder clones VMs from existing templates.
- VMware Player is not required.
- It uses the official vCenter API, and does not require ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor)
## Examples
See complete Ubuntu, Windows, and macOS templates in the [examples folder](https://github.com/hashicorp/packer/tree/master/builder/vsphere/examples/).
## VSphere-Clone Configuration Reference
There are many configuration options available for this builder. In addition to
the items listed here, you will want to look at the general configuration
references for [ISO](#iso-configuration),
[HTTP](#http-directory-configuration),
[Boot](#boot-configuration),
[Driver](#driver-configuration),
[Hardware](#hardware-configuration),
[Output](#output-configuration),
[Run](#run-configuration),
[Shutdown](#shutdown-configuration),
[Communicator](#communicator-configuration),
[Tools](#tools-configuration),
[vmx](#vmx-configuration),
[Export](#export-configuration),
configuration references, which are
necessary for this build to succeed and can be found further down the page.
@include 'partials/builder/vsphere/clone/Config-not-required.mdx'
### Clone Configuration
@include 'partials/builder/vsphere/clone/CloneConfig-not-required.mdx'
### Extra Configuration Parameters
@include 'partials/builder/vsphere/common/ConfigParamsConfig-not-required.mdx'
### Connection Configuration
@include 'partials/builder/vsphere/common/ConnectConfig-not-required.mdx'
### Hardware Configuration
@include 'partials/builder/vsphere/common/HardwareConfig-not-required.mdx'
### Location Configuration
@include 'partials/builder/vsphere/common/LocationConfig-not-required.mdx'
### Run Configuration
@include 'partials/builder/vsphere/common/RunConfig-not-required.mdx'
### Shutdown Configuration
@include 'partials/builder/vsphere/common/ShutdownConfig-not-required.mdx'
### Wait Configuration
@include 'partials/builder/vsphere/common/WaitIpConfig-not-required.mdx'
### Communicator configuration
#### Optional common fields:
@include 'partials/helper/communicator/Config-not-required.mdx'
#### Optional SSH fields:
@include 'partials/helper/communicator/SSH-not-required.mdx'
#### Optional WinRM fields:
@include 'partials/helper/communicator/WinRM-not-required.mdx'
### Export Configuration
@include 'partials/builder/vsphere/common/ExportConfig.mdx'
### Optional:
@include 'partials/builder/vsphere/common/ExportConfig-not-required.mdx'
#### Output Configuration:
@include 'partials/builder/vsphere/common/OutputConfig-not-required.mdx'
## Working with Clusters
#### Standalone Hosts
Only use the `host` option. Optionally specify a `resource_pool`:
```
"host": "esxi-1.vsphere65.test",
"resource_pool": "pool1",
```
#### Clusters Without DRS
Use the `cluster` and `host`parameters:
```
"cluster": "cluster1",
"host": "esxi-2.vsphere65.test",
```
#### Clusters With DRS
Only use the `cluster` option. Optionally specify a `resource_pool`:
```
"cluster": "cluster2",
"resource_pool": "pool1",
```
## Required vSphere Permissions
- VM folder (this object and children):
```
Virtual machine -> Inventory
Virtual machine -> Configuration
Virtual machine -> Interaction
Virtual machine -> Snapshot management
Virtual machine -> Provisioning
```
Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235.
- Resource pool, host, or cluster (this object):
```
Resource -> Assign virtual machine to resource pool
```
- Host in clusters without DRS (this object):
```
Read-only
```
- Datastore (this object):
```
Datastore -> Allocate space
Datastore -> Browse datastore
Datastore -> Low level file operations
```
- Network (this object):
```
Network -> Assign network
```
- Distributed switch (this object):
```
Read-only
```
For floppy image upload:
- Datacenter (this object):
```
Datastore -> Low level file operations
```
- Host (this object):
```
Host -> Configuration -> System Management
```

View File

@ -2,11 +2,11 @@
modeline: |
vim: set ft=pandoc:
description: |
This VMware Packer builder starts from an ISO and creates a vm using the
vSphere API to build on a remote VMWare machine.
This VMware Packer builder starts from an ISO and creates a vm using the
vSphere API to build on a remote VMWare machine.
layout: docs
page_title: 'VSphere ISO - Builders'
sidebar_current: 'docs-builders-vsphere-iso'
page_title: VSphere ISO - Builders
sidebar_current: docs-builders-vsphere-iso
---
# Packer Builder for VMware vSphere
@ -42,37 +42,43 @@ references for [HTTP](#http-directory-configuration),
configuration references, which are
necessary for this build to succeed and can be found further down the page.
<%= partial "partials/builder/vsphere/iso/Config-not-required" %>
@include 'partials/builder/vsphere/iso/Config-not-required.mdx'
### Connection Configuration
<%= partial "partials/builder/vsphere/common/ConnectConfig-not-required" %>
@include 'partials/builder/vsphere/common/ConnectConfig-not-required.mdx'
### Hardware Configuration
<%= partial "partials/builder/vsphere/common/HardwareConfig-not-required" %>
@include 'partials/builder/vsphere/common/HardwareConfig-not-required.mdx'
### Location Configuration
<%= partial "partials/builder/vsphere/common/LocationConfig-not-required" %>
@include 'partials/builder/vsphere/common/LocationConfig-not-required.mdx'
### Run Configuration
<%= partial "partials/builder/vsphere/common/RunConfig-not-required" %>
@include 'partials/builder/vsphere/common/RunConfig-not-required.mdx'
### Shutdown Configuration
<%= partial "partials/builder/vsphere/common/ShutdownConfig-not-required" %>
@include 'partials/builder/vsphere/common/ShutdownConfig-not-required.mdx'
### Wait Configuration
<%= partial "partials/builder/vsphere/common/WaitIpConfig-not-required" %>
@include 'partials/builder/vsphere/common/WaitIpConfig-not-required.mdx'
### ISO Configuration
<%= partial "partials/common/ISOConfig" %>
@include 'partials/common/ISOConfig.mdx'
#### Required:
<%= partial "partials/common/ISOConfig-required" %>
@include 'partials/common/ISOConfig-required.mdx'
#### Optional:
<%= partial "partials/common/ISOConfig-not-required" %>
@include 'partials/common/ISOConfig-not-required.mdx'
### CDRom Configuration
@ -91,20 +97,24 @@ from the datastore. Example:
],
```
<%= partial "partials/builder/vsphere/iso/CDRomConfig-not-required" %>
@include 'partials/builder/vsphere/iso/CDRomConfig-not-required.mdx'
### Create Configuration
<%= partial "partials/builder/vsphere/iso/CreateConfig-not-required" %>
@include 'partials/builder/vsphere/iso/CreateConfig-not-required.mdx'
### Network Adapter Configuration
<%= partial "partials/builder/vsphere/iso/NIC-required" %>
@include 'partials/builder/vsphere/iso/NIC-required.mdx'
### Storage Configuration
<%= partial "partials/builder/vsphere/iso/DiskConfig-required" %>
<%= partial "partials/builder/vsphere/iso/DiskConfig-not-required" %>
@include 'partials/builder/vsphere/iso/DiskConfig-required.mdx'
@include 'partials/builder/vsphere/iso/DiskConfig-not-required.mdx'
### Floppy Configuration
<%= partial "partials/builder/vsphere/iso/FloppyConfig-not-required" %>
@include 'partials/builder/vsphere/iso/FloppyConfig-not-required.mdx'
### Export Configuration
<%= partial "partials/builder/vsphere/common/ExportConfig" %>
@ -118,43 +128,51 @@ from the datastore. Example:
<%= partial "partials/builder/vsphere/common/OutputConfig-not-required" %>
### Extra Configuration Parameters
<%= partial "partials/builder/vsphere/common/ConfigParamsConfig-not-required" %>
@include 'partials/builder/vsphere/common/ConfigParamsConfig-not-required.mdx'
### Communicator configuration
#### Optional common fields:
<%= partial "partials/helper/communicator/Config-not-required" %>
@include 'partials/helper/communicator/Config-not-required.mdx'
#### Optional Network Adapter fields:
<%= partial "partials/builder/vsphere/iso/NIC-not-required" %>
@include 'partials/builder/vsphere/iso/NIC-not-required.mdx'
#### Optional SSH fields:
<%= partial "partials/helper/communicator/SSH-not-required" %>
@include 'partials/helper/communicator/SSH-not-required.mdx'
#### Optional WinRM fields:
<%= partial "partials/helper/communicator/WinRM-not-required" %>
@include 'partials/helper/communicator/WinRM-not-required.mdx'
## Working with Clusters
#### Standalone Hosts
Only use the `host` option. Optionally specify a `resource_pool`:
```
"host": "esxi-1.vsphere65.test",
"resource_pool": "pool1",
```
#### Clusters Without DRS
Use the `cluster` and `host `parameters:
Use the `cluster` and `host`parameters:
```
"cluster": "cluster1",
"host": "esxi-2.vsphere65.test",
```
#### Clusters With DRS
Only use the `cluster` option. Optionally specify a `resource_pool`:
```
"cluster": "cluster2",
"resource_pool": "pool1",
@ -162,45 +180,45 @@ Only use the `cluster` option. Optionally specify a `resource_pool`:
## Required vSphere Permissions
* VM folder (this object and children):
```
Virtual machine -> Inventory
Virtual machine -> Configuration
Virtual machine -> Interaction
Virtual machine -> Snapshot management
Virtual machine -> Provisioning
```
Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235.
* Resource pool, host, or cluster (this object):
```
Resource -> Assign virtual machine to resource pool
```
* Host in clusters without DRS (this object):
```
Read-only
```
* Datastore (this object):
```
Datastore -> Allocate space
Datastore -> Browse datastore
Datastore -> Low level file operations
```
* Network (this object):
```
Network -> Assign network
```
* Distributed switch (this object):
```
Read-only
```
- VM folder (this object and children):
```
Virtual machine -> Inventory
Virtual machine -> Configuration
Virtual machine -> Interaction
Virtual machine -> Snapshot management
Virtual machine -> Provisioning
```
Individual privileges are listed in https://github.com/jetbrains-infra/packer-builder-vsphere/issues/97#issuecomment-436063235.
- Resource pool, host, or cluster (this object):
```
Resource -> Assign virtual machine to resource pool
```
- Host in clusters without DRS (this object):
```
Read-only
```
- Datastore (this object):
```
Datastore -> Allocate space
Datastore -> Browse datastore
Datastore -> Low level file operations
```
- Network (this object):
```
Network -> Assign network
```
- Distributed switch (this object):
```
Read-only
```
For floppy image upload:
* Datacenter (this object):
```
Datastore -> Low level file operations
```
* Host (this object):
```
Host -> Configuration -> System Management
```
- Datacenter (this object):
```
Datastore -> Low level file operations
```
- Host (this object):
```
Host -> Configuration -> System Management
```

View File

@ -1,10 +1,10 @@
---
description: |
The yandex Packer builder is able to create images for use with
Yandex.Cloud based on existing images.
The yandex Packer builder is able to create images for use with
Yandex.Cloud based on existing images.
layout: docs
page_title: 'Yandex Compute - Builders'
sidebar_current: 'docs-builders-yandex'
page_title: Yandex Compute - Builders
sidebar_current: docs-builders-yandex
---
# Yandex Compute Builder
@ -20,22 +20,19 @@ based on existing images.
Yandex.Cloud services authentication requires one of the following security credentials:
- OAuth token
- File with Service Account Key
- OAuth token
- File with Service Account Key
### Authentication Using Token
To authenticate with an OAuth token only `token` config key is needed.
Or use the `YC_TOKEN` environment variable.
### Authentication Using Service Account Key File
To authenticate with a service account credential, only `service_account_key_file` is needed.
Or use the `YC_SERVICE_ACCOUNT_KEY_FILE` environment variable.
## Basic Example
```json
@ -55,13 +52,13 @@ Configuration options are organized below into two categories: required and
optional. Within each category, the available options are alphabetized and
described.
In addition to the options listed here, a [communicator](/docs/templates/communicator.html)
In addition to the options listed here, a [communicator](/docs/templates/communicator.html)
can be configured for this builder.
### Required:
<%= partial "partials/builder/yandex/Config-required" %>
@include 'partials/builder/yandex/Config-required.mdx'
### Optional:
<%= partial "partials/builder/yandex/Config-not-required" %>
@include 'partials/builder/yandex/Config-not-required.mdx'

View File

@ -0,0 +1,69 @@
---
description: |
The `packer build` command takes a template and runs all the builds within it
in order to generate a set of artifacts. The various builds specified within a
template are executed in parallel, unless otherwise specified. And the
artifacts that are created will be outputted at the end of the build.
layout: docs
page_title: packer build - Commands
sidebar_current: docs-commands-build
---
# `build` Command
The `packer build` command takes a template and runs all the builds within it
in order to generate a set of artifacts. The various builds specified within a
template are executed in parallel, unless otherwise specified. And the
artifacts that are created will be outputted at the end of the build.
## Options
- `-color=false` - Disables colorized output. Enabled by default.
- `-debug` - Disables parallelization and enables debug mode. Debug mode
flags the builders that they should output debugging information. The exact
behavior of debug mode is left to the builder. In general, builders usually
will stop between each step, waiting for keyboard input before continuing.
This will allow the user to inspect state and so on.
- `-except=foo,bar,baz` - Run all the builds and post-processors except those
with the given comma-separated names. Build and post-processor names by
default are their type, unless a specific `name` attribute is specified
within the configuration. Any post-processor following a skipped
post-processor will not run. Because post-processors can be nested in
arrays a different post-processor chain can still run. A post-processor
with an empty name will be ignored.
- `-force` - Forces a builder to run when artifacts from a previous build
prevent a build from running. The exact behavior of a forced build is left
to the builder. In general, a builder supporting the forced build will
remove the artifacts from the previous build. This will allow the user to
repeat a build without having to manually clean these artifacts beforehand.
- `-on-error=cleanup` (default), `-on-error=abort`, `-on-error=ask` - Selects
what to do when the build fails. `cleanup` cleans up after the previous
steps, deleting temporary files and virtual machines. `abort` exits without
any cleanup, which might require the next build to use `-force`. `ask`
presents a prompt and waits for you to decide to clean up, abort, or retry
the failed step.
- `-only=foo,bar,baz` - Only run the builds with the given comma-separated
names. Build names by default are their type, unless a specific `name`
attribute is specified within the configuration. `-only` does not apply to
post-processors.
- `-parallel=false` - /!\ Deprecated, use `-parallel-builds=1` instead,
setting `-parallel-builds=N` to more that 0 will ignore the `-parallel`
setting. Set `-parallel=false` to disable parallelization of multiple
builders (on by default).
- `-parallel-builds=N` - Limit the number of builds to run in parallel, 0
means no limit (defaults to 0).
- `-timestamp-ui` - Enable prefixing of each ui output with an RFC3339
timestamp.
- `-var` - Set a variable in your packer template. This option can be used
multiple times. This is useful for setting version numbers for your build.
- `-var-file` - Set template variables from a file.

Some files were not shown because too many files have changed in this diff Show More