Merge pull request #6930 from rickard-von-essen/doc-user-data

docs: Improved docs for user_script
This commit is contained in:
Adrien Delorme 2018-10-31 15:33:46 +01:00 committed by GitHub
commit 609d4238c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 102 additions and 72 deletions

View File

@ -76,26 +76,32 @@ builder.
- `image_description` (string) - The description of the image, with a length
limit of 0 to 256 characters. Leaving it blank means null, which is the
default value. It cannot begin with `http://` or `https://`.
- `system_disk_mapping` (image disk mapping) - Image disk mapping for system disk.
- `disk_category` (string) - Category of the system disk. Optional values are:
- `system_disk_mapping` (image disk mapping) - Image disk mapping for system
disk.
- `disk_category` (string) - Category of the system disk. Optional values
are:
- `cloud` - general cloud disk
- `cloud_efficiency` - efficiency cloud disk
- `cloud_ssd` - cloud SSD
For phased-out instance types and non-I/O optimized instances, the default value is cloud.
Otherwise, the default value is cloud_efficiency.
- `disk_description` (string) - The value of disk description is blank by default. \[2, 256\] characters.
The disk description will appear on the console. It cannot begin with `http://` or `https://`.
- `disk_name` (string) - The value of disk name is blank by default. \[2, 128\]
English or Chinese characters, must begin with an uppercase/lowercase letter
or Chinese character. Can contain numbers, `.`, `_` and `-`. The disk name
will appear on the console. It cannot begin with `http://` or `https://`.
- `disk_size` (number) - Size of the system disk, measured in GiB. Value range: \[20, 500\]. The specified value
must be equal to or greater than max{20, ImageSize}. Default value: max{40, ImageSize}.
For phased-out instance types and non-I/O optimized instances, the
default value is cloud. Otherwise, the default value is
cloud\_efficiency.
- `disk_description` (string) - The value of disk description is blank by
default. \[2, 256\] characters. The disk description will appear on the
console. It cannot begin with `http://` or `https://`.
- `disk_name` (string) - The value of disk name is blank by default. \[2,
128\] English or Chinese characters, must begin with an
uppercase/lowercase letter or Chinese character. Can contain numbers,
`.`, `_` and `-`. The disk name will appear on the console. It cannot
begin with `http://` or `https://`.
- `disk_size` (number) - Size of the system disk, measured in GiB. Value
range: \[20, 500\]. The specified value must be equal to or greater
than max{20, ImageSize}. Default value: max{40, ImageSize}.
- `image_disk_mappings` (array of image disk mappings) - Add one or more data
disks to the image.
@ -128,9 +134,9 @@ builder.
begin with `http://` or `https://`.
- `disk_size` (number) - Size of the data disk, in GB, values range:
- `cloud` - 5 ~ 2000
- `cloud_efficiency` - 20 ~ 2048
- `cloud_ssd` - 20 ~ 2048
- `cloud` - 5 \~ 2000
- `cloud_efficiency` - 20 \~ 2048
- `cloud_ssd` - 20 \~ 2048
The value should be equal to or greater than the size of the specific
SnapshotId.
@ -214,10 +220,14 @@ builder.
`export TLSHandshakeTimeout=30`, it will set the TLS handshake timeout
value to 30s.
- `user_data` (string) - The UserData of an instance must be encoded in
`Base64` format, and the maximum size of the raw data is `16 KB`.
- `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) - The file name of the userdata.
- `user_data_file` (string) - Path to a file that will be used for the user
data when launching the instance.
- `vpc_cidr_block` (string) - Value options: `192.168.0.0/16` and
`172.16.0.0/16`. When not specified, the default value is `172.16.0.0/16`.
@ -273,7 +283,7 @@ Here is a basic example for Alicloud.
}
```
~> Note: Images can become deprecated after a while; run
\~> Note: Images can become deprecated after a while; run
`aliyun ecs DescribeImages` to find one that exists.
See the

View File

@ -198,11 +198,11 @@ builder.
- `enable_t2_unlimited` (boolean) - Enabling T2 Unlimited allows the source
instance to burst additional CPU beyond its available \[CPU Credits\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html</a>)
for as long as the demand exists. This is in contrast to the standard
configuration that only allows an instance to consume up to its available
CPU Credits. See the AWS documentation for \[T2 Unlimited\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html</a>)
and the **T2 Unlimited Pricing** section of the [Amazon EC2 On-Demand
Pricing](https://aws.amazon.com/ec2/pricing/on-demand/) document for more
information. By default this option is disabled and Packer will set up a
@ -242,8 +242,8 @@ builder.
profile](https://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
to launch the EC2 instance with.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS verification of
the AWS EC2 endpoint. The default is `false`.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the AWS EC2 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 instance
@ -499,6 +499,8 @@ builder.
- `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.

View File

@ -191,11 +191,11 @@ builder.
- `enable_t2_unlimited` (boolean) - Enabling T2 Unlimited allows the source
instance to burst additional CPU beyond its available \[CPU Credits\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html</a>)
for as long as the demand exists. This is in contrast to the standard
configuration that only allows an instance to consume up to its available
CPU Credits. See the AWS documentation for \[T2 Unlimited\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html</a>)
and the **T2 Unlimited Pricing** section of the [Amazon EC2 On-Demand
Pricing](https://aws.amazon.com/ec2/pricing/on-demand/) document for more
information. By default this option is disabled and Packer will set up a
@ -235,8 +235,8 @@ builder.
profile](https://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
to launch the EC2 instance with.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS verification of
the AWS EC2 endpoint. The default is `false`.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the AWS EC2 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 instance
@ -491,6 +491,8 @@ builder.
- `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.

View File

@ -164,11 +164,11 @@ builder.
- `enable_t2_unlimited` (boolean) - Enabling T2 Unlimited allows the source
instance to burst additional CPU beyond its available \[CPU Credits\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html</a>)
for as long as the demand exists. This is in contrast to the standard
configuration that only allows an instance to consume up to its available
CPU Credits. See the AWS documentation for \[T2 Unlimited\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html</a>)
and the 'T2 Unlimited Pricing' section of the [Amazon EC2 On-Demand
Pricing](https://aws.amazon.com/ec2/pricing/on-demand/) document for more
information. By default this option is disabled and Packer will set up a
@ -189,8 +189,8 @@ builder.
profile](https://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
to launch the EC2 instance with.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS verification of
the AWS EC2 endpoint. The default is `false`.
- `insecure_skip_tls_verify` (boolean) - This allows skipping TLS
verification of the AWS EC2 endpoint. The default is `false`.
- `mfa_code` (string) - The MFA
[TOTP](https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm)
@ -401,6 +401,8 @@ builder.
- `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.

View File

@ -38,7 +38,7 @@ Tools](https://aws.amazon.com/developertools/368) are installed onto the
machine. This can be done within a provisioner, but must be done before the
builder finishes running.
~&gt; Instance builds are not supported for Windows. Use
\~&gt; Instance builds are not supported for Windows. Use
[`amazon-ebs`](amazon-ebs.html) instead.
## Configuration Reference
@ -214,11 +214,11 @@ builder.
- `enable_t2_unlimited` (boolean) - Enabling T2 Unlimited allows the source
instance to burst additional CPU beyond its available \[CPU Credits\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html</a>)
for as long as the demand exists. This is in contrast to the standard
configuration that only allows an instance to consume up to its available
CPU Credits. See the AWS documentation for \[T2 Unlimited\]
(<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html>)
(<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html" class="uri">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html</a>)
and the 'T2 Unlimited Pricing' section of the [Amazon EC2 On-Demand
Pricing](https://aws.amazon.com/ec2/pricing/on-demand/) document for more
information. By default this option is disabled and Packer will set up a
@ -483,6 +483,8 @@ builder.
- `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.
@ -618,8 +620,8 @@ sudo -i -n ec2-bundle-vol \
The available template variables should be self-explanatory based on the
parameters they're used to satisfy the `ec2-bundle-vol` command.
~&gt; **Warning!** Some versions of ec2-bundle-vol silently ignore all .pem and
.gpg files during the bundling of the AMI, which can cause problems on some
\~&gt; **Warning!** Some versions of ec2-bundle-vol silently ignore all .pem
and .gpg files during the bundling of the AMI, which can cause problems on some
systems, such as Ubuntu. You may want to customize the bundle volume command to
include those files (see the `--no-filter` option of `ec2-bundle-vol`).

View File

@ -148,9 +148,9 @@ Providing `temp_resource_group_name` or `location` in combination with
`USGovernmentCloud` and `AzureUSGovernmentCloud` are also supported.
- `custom_data_file` (string) Specify a file containing custom data to inject
into the cloud-init process. The contents of the file are read, base64
encoded, and injected into the ARM template. The custom data will be passed
to cloud-init for processing at the time of provisioning. See
into the cloud-init process. The contents of the file are read and injected
into the ARM template. The custom data will be passed to cloud-init for
processing at the time of provisioning. See
[documentation](http://cloudinit.readthedocs.io/en/latest/topics/examples.html)
to learn more about custom data, and how it can be used to influence the
provisioning process.
@ -250,7 +250,6 @@ Providing `temp_resource_group_name` or `location` in combination with
type* - the target must be a *Managed Image*.
<!-- -->
"shared_image_gallery": {
"subscription": "00000000-0000-0000-0000-00000000000",
"resource_group": "ResourceGroup",
@ -421,8 +420,8 @@ experience. These values can be changed by the user to more suitable values.
## Implementation
~&gt; **Warning!** This is an advanced topic. You do not need to understand the
implementation to use the Azure builder.
\~&gt; **Warning!** This is an advanced topic. You do not need to understand
the implementation to use the Azure builder.
The Azure builder uses ARM
[templates](https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/)

View File

@ -174,7 +174,9 @@ builder.
- `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.
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

View File

@ -41,18 +41,18 @@ builder.
- `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
<https://developers.digitalocean.com/documentation/v2/#list-all-images> for
details on how to get a list of the accepted image names/slugs.
<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
<https://developers.digitalocean.com/documentation/v2/#list-all-regions>
<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
<https://developers.digitalocean.com/documentation/v2/#list-all-sizes> for
the accepted size names/slugs.
<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:
@ -83,7 +83,9 @@ builder.
droplet to enter a desired state (such as "active") before timing out. The
default state timeout is "6m".
- `user_data` (string) - User data to launch with the Droplet.
- `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.

View File

@ -62,7 +62,9 @@ builder.
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.
- `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.

View File

@ -49,14 +49,14 @@ Platform](https://www.ncloud.com/).
access source (`0.0.0.0/0`) and allowed port (5985) must be created in
advance.
- `user_data` (string) - Init script to run when an instance is created.
- For Linux servers, Python, Perl, and Shell scripts can be used. The
path of the script to run should be included at the beginning of the
script, like \#!/usr/bin/env python, \#!/bin/perl, or \#!/bin/bash.
- For Windows servers, only Visual Basic scripts can be used.
- All scripts must be written in English.
- `user_data_file` (string) - A path to a file containing a `user_data`
script. See above for more information.
- `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.
- `region` (string) - Name of the region where you want to create an image.
(default: Korea)

View File

@ -25,10 +25,10 @@ created. This simplifies configuration quite a bit.
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)
\~&gt; **Note:** To use OpenStack builder with the OpenStack Newton (Oct 2016)
or earlier, we recommend you use Packer v1.1.2 or earlier version.
~&gt; **OpenStack Liberty or later requires OpenSSL!** To use the OpenStack
\~&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
[`ssh_keypair_name`](openstack.html#ssh_keypair_name) nor
@ -36,8 +36,9 @@ installed *if you are using temporary key pairs*, i.e. don't use
OS'es have OpenSSL installed by default except Windows. This have been resolved
in OpenStack Ocata(Feb 2017).
~&gt; **Note:** OpenStack Block Storage volume support is available only for V3
Block Storage API. It's available in OpenStack since Mitaka release (Apr 2016).
\~&gt; **Note:** OpenStack Block Storage volume support is available only for
V3 Block Storage API. It's available in OpenStack since Mitaka release (Apr
2016).
## Configuration Reference
@ -258,6 +259,8 @@ builder.
- `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.
@ -404,7 +407,7 @@ variable `OS_REGION_NAME` or `OS_REGION_ID` and
`export OS_TENANT_NAME=$OS_PROJECT_NAME` or
`export OS_TENANT_ID=$OS_PROJECT_ID`.
~&gt; `OS_TENANT_NAME` or `OS_TENANT_ID` must be used even with Identity v3,
\~&gt; `OS_TENANT_NAME` or `OS_TENANT_ID` must be used even with Identity v3,
`OS_PROJECT_NAME` and `OS_PROJECT_ID` has no effect in Packer.
To troubleshoot authorization issues test you environment variables with the

View File

@ -133,16 +133,20 @@ builder.
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> on the launched instance.
be obtained from at
<a href="http://169.254.169.254" class="uri">http://169.254.169.254</a> on
the launched instance.
- `user_data` (string) - user\_data to be used by cloud init. See [the Oracle
- `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.
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
- `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"`