docs: Various doc clean-ups to fix code block formatting and syntax highlighting (#8868)

This commit is contained in:
Wilken Rivera 2020-03-12 10:05:08 -04:00 committed by GitHub
parent 79f1fab836
commit 7b705545d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 477 additions and 435 deletions

View File

@ -120,7 +120,6 @@ type Config struct {
SourceAmi string `mapstructure:"source_ami" required:"true"`
// Filters used to populate the source_ami field. Example:
//
//
//```json
//{
// "source_ami_filter": {

View File

@ -22,7 +22,7 @@ import (
// build instance at launch using a specific non-default kms key:
//
// ```json
// "[{
// [{
// "device_name": "/dev/sda1",
// "encrypted": true,
// "kms_key_id": "1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d"

View File

@ -35,7 +35,8 @@ type RunConfig struct {
SourceImageName string `mapstructure:"source_image_name" required:"true"`
// Filters used to populate filter options. Example:
//
// ``` json {
// ```json
//{
// "source_image_filter": {
// "filters": {
// "name": "ubuntu-16.04",

View File

@ -234,7 +234,8 @@ type Config struct {
//
// The following shows a sample usage:
//
// ``` json {
// ```json
//{
// "qemuargs": [
// [ "-m", "1024M" ],
// [ "--no-acpi", "" ],
@ -252,9 +253,11 @@ type Config struct {
// would produce the following (not including other defaults supplied by
// the builder and not otherwise conflicting with the qemuargs):
//
// ``` text qemu-system-x86 -m 1024m --no-acpi -netdev
// ```text
// qemu-system-x86 -m 1024m --no-acpi -netdev
// user,id=mynet0,hostfwd=hostip:hostport-guestip:guestport -device
// virtio-net,netdev=mynet0" ```
// virtio-net,netdev=mynet0"
// ```
//
// ~> **Windows Users:** [QEMU for Windows](https://qemu.weilnetz.de/)
// builds are available though an environmental variable does need to be
@ -264,17 +267,21 @@ type Config struct {
// The following shows the environment variable that needs to be set for
// Windows QEMU support:
//
// ``` text setx SDL_STDIO_REDIRECT=0 ```
// ```text
// setx SDL_STDIO_REDIRECT=0
// ```
//
// You can also use the `SSHHostPort` template variable to produce a packer
// template that can be invoked by `make` in parallel:
//
// ``` json {
// ```json
//{
// "qemuargs": [
// [ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=forward"],
// [ "-device", "virtio-net,netdev=forward,id=net0"]
// ]
// } ```
// }
// ```
//
// `make -j 3 my-awesome-packer-templates` spawns 3 packer processes, each
// of which will bind to their own SSH port as determined by each process.

View File

@ -96,9 +96,13 @@ type Config struct {
// Virtualbox 6, install an [extension
// pack](https://www.virtualbox.org/wiki/Downloads#VirtualBox6.0.14OracleVMVirtualBoxExtensionPack)
// and you will need to enable EFI mode for nvme to work, ex:
//
// ```json
// "vboxmanage": [
// [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ],
// ]
// ```
//
HardDriveInterface string `mapstructure:"hard_drive_interface" required:"false"`
// The number of ports available on any SATA controller created, defaults
// to 1. VirtualBox supports up to 30 ports on a maximum of 1 SATA

View File

@ -208,6 +208,7 @@ involving the `nvme_device_path` option above. Read that for more information.
A working example for mounting an NVMe device is below:
```json
{
"variables": {
"region" : "us-east-2"
@ -239,6 +240,7 @@ A working example for mounting an NVMe device is below:
}
]
}
```
Note that in the `nvme_device_path` you must end with the `p`; if you try to
define the partition in this path (e.g. `nvme_device_path`: `/dev/nvme1n1p1`)

View File

@ -203,7 +203,7 @@ 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"
blank. Example: `{{.HTTPIP}}:{{.HTTPPort}}/path/to/a/file/in/http_directory`
## Basic Example

View File

@ -144,7 +144,7 @@ the Compress post-processor will not work with this builder.
Sample for `hashicorp/precise64` with virtualbox provider.
```
```json
{
"builders": [
{

View File

@ -156,7 +156,7 @@ 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": [
{

View File

@ -146,7 +146,7 @@ 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": [
{

View File

@ -290,7 +290,7 @@ 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": [
{

View File

@ -173,6 +173,7 @@ still in beta. There will be some limitations as a result. For example, it will
likely not work unless both Packer and the scripts you want to run are both on
the C drive.
```json
{
"builders": [
{
@ -197,6 +198,7 @@ the C drive.
}
]
}
```
## Default Environmental Variables
@ -280,11 +282,13 @@ For a shell script, that means the script **must** exit with a zero code. You
Example of running a .cmd file on windows:
```json
{
"type": "shell-local",
"environment_vars": ["SHELLLOCALTEST=ShellTest1"],
"scripts": ["./scripts/test_cmd.cmd"]
},
}
```
Contents of "test\_cmd.cmd":
@ -293,16 +297,19 @@ Contents of "test\_cmd.cmd":
Example of running an inline command on windows: Required customization:
tempfile\_extension
```json
{
"type": "shell-local",
"environment_vars": ["SHELLLOCALTEST=ShellTest2"],
"tempfile_extension": ".cmd",
"inline": ["echo %SHELLLOCALTEST%"]
},
}
```
Example of running a bash command on windows using WSL: Required
customizations: use\_linux\_pathing and execute\_command
```json
{
"type": "shell-local",
"environment_vars": ["SHELLLOCALTEST=ShellTest3"],
@ -310,6 +317,7 @@ customizations: use\_linux\_pathing and execute\_command
"use_linux_pathing": true,
"script": "./scripts/example_bash.sh"
}
```
Contents of "example\_bash.sh":
@ -319,6 +327,7 @@ Contents of "example\_bash.sh":
Example of running a powershell script on windows: Required customizations:
env\_var\_format and execute\_command
```json
{
"type": "shell-local",
"environment_vars": ["SHELLLOCALTEST=ShellTest4"],
@ -326,10 +335,12 @@ env\_var\_format and execute\_command
"env_var_format": "$env:%s=\"%s\"; ",
"script": "./scripts/example_ps.ps1"
}
```
Example of running a powershell script on windows as "inline": Required
customizations: env\_var\_format, tempfile\_extension, and execute\_command
```json
{
"type": "shell-local",
"tempfile_extension": ".ps1",
@ -338,34 +349,41 @@ customizations: env\_var\_format, tempfile\_extension, and execute\_command
"env_var_format": "$env:%s=\"%s\"; ",
"inline": ["write-output $env:SHELLLOCALTEST"]
}
```
### Unix Host
Example of running a bash script on unix:
```json
{
"type": "shell-local",
"environment_vars": ["PROVISIONERTEST=ProvisionerTest1"],
"scripts": ["./scripts/example_bash.sh"]
}
```
Example of running a bash "inline" on unix:
```json
{
"type": "shell-local",
"environment_vars": ["PROVISIONERTEST=ProvisionerTest2"],
"inline": ["echo hello",
"echo $PROVISIONERTEST"]
}
```
Example of running a python script on unix:
```json
{
"type": "shell-local",
"script": "hello.py",
"environment_vars": ["HELLO_USER=packeruser"],
"execute_command": ["/bin/sh", "-c", "{{.Vars}} /usr/local/bin/python {{.Script}}"]
}
```
Where "hello.py" contains:

View File

@ -242,7 +242,7 @@ Example of running a .cmd file on windows:
"type": "shell-local",
"environment_vars": ["SHELLLOCALTEST=ShellTest1"],
"scripts": ["./scripts/test_cmd.cmd"]
},
}
Contents of "test\_cmd.cmd":
@ -256,7 +256,7 @@ tempfile\_extension
"environment_vars": ["SHELLLOCALTEST=ShellTest2"],
"tempfile_extension": ".cmd",
"inline": ["echo %SHELLLOCALTEST%"]
},
}
Example of running a bash command on windows using WSL: Required
customizations: use\_linux\_pathing and execute\_command

View File

@ -68,7 +68,7 @@ Optional parameters:
{
"type": "windows-restart",
"restart_check_command": "powershell -command \"& {Write-Output 'restarted.'}\""
},
}
```
- `restart_timeout` (string) - The timeout to wait for the restart. By

View File

@ -91,7 +91,7 @@ Here is a full list of the available functions for reference.
These are unique to the SSH communicator and are unset when using other communicators.
__SSHPublicKey__ and __SSHPrivateKey__ can have escape sequences and special characters so their output should be single quoted to avoid surprises. For example:
```
```json
{
...
"provisioners": [
@ -213,7 +213,7 @@ are available to customize the
[`execute_command`](/docs/provisioners/shell.html#execute_command) parameter
used to determine how Packer will run the shell command.
``` liquid
```json
{
"provisioners": [
{

View File

@ -88,7 +88,7 @@ Values within `except` could also be a *post-processor* name.
You can optionally create a single specialized provisioner field called an
`error-cleanup-provisioner`. This provisioner will not run unless the normal
provisioning run fails. If the normal provisioning run does fail, this special
error provisioner will run *before the instanace is shut down*. This allows you
error provisioner will run *before the instance is shut down*. This allows you
to make last minute changes and clean up behaviors that Packer may not be able
to clean up on its own.

View File

@ -67,7 +67,7 @@ Date only, not time:
"variables":
{
"myvar": "packer-{{isotime \"2006-01-02\"}}"
},
}
```
A timestamp down to the millisecond:
@ -76,7 +76,7 @@ A timestamp down to the millisecond:
"variables":
{
"myvar": "packer-{{isotime \"Jan-_2-15:04:05.000\"}}"
},
}
```
Or just the time as it would appear on a digital clock:
@ -85,5 +85,5 @@ Or just the time as it would appear on a digital clock:
"variables":
{
"myvar": "packer-{{isotime \"3:04PM\"}}"
},
}
```

View File

@ -8,7 +8,7 @@ The following mapping will tell Packer to encrypt the root volume of the
build instance at launch using a specific non-default kms key:
```json
"[{
[{
"device_name": "/dev/sda1",
"encrypted": true,
"kms_key_id": "1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d"

View File

@ -10,7 +10,8 @@
- `source_image_filter` (ImageFilter) - Filters used to populate filter options. Example:
``` json {
```json
{
"source_image_filter": {
"filters": {
"name": "ubuntu-16.04",

View File

@ -131,7 +131,8 @@
The following shows a sample usage:
``` json {
```json
{
"qemuargs": [
[ "-m", "1024M" ],
[ "--no-acpi", "" ],
@ -149,9 +150,11 @@
would produce the following (not including other defaults supplied by
the builder and not otherwise conflicting with the qemuargs):
``` text qemu-system-x86 -m 1024m --no-acpi -netdev
```text
qemu-system-x86 -m 1024m --no-acpi -netdev
user,id=mynet0,hostfwd=hostip:hostport-guestip:guestport -device
virtio-net,netdev=mynet0" ```
virtio-net,netdev=mynet0"
```
~> **Windows Users:** [QEMU for Windows](https://qemu.weilnetz.de/)
builds are available though an environmental variable does need to be
@ -161,17 +164,21 @@
The following shows the environment variable that needs to be set for
Windows QEMU support:
``` text setx SDL_STDIO_REDIRECT=0 ```
```text
setx SDL_STDIO_REDIRECT=0
```
You can also use the `SSHHostPort` template variable to produce a packer
template that can be invoked by `make` in parallel:
``` json {
```json
{
"qemuargs": [
[ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=forward"],
[ "-device", "virtio-net,netdev=forward,id=net0"]
]
} ```
}
```
`make -j 3 my-awesome-packer-templates` spawns 3 packer processes, each
of which will bind to their own SSH port as determined by each process.

View File

@ -53,9 +53,12 @@
Virtualbox 6, install an [extension
pack](https://www.virtualbox.org/wiki/Downloads#VirtualBox6.0.14OracleVMVirtualBoxExtensionPack)
and you will need to enable EFI mode for nvme to work, ex:
```json
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--firmware", "EFI" ],
]
```
- `sata_port_count` (int) - The number of ports available on any SATA controller created, defaults
to 1. VirtualBox supports up to 30 ports on a maximum of 1 SATA