This commit is contained in:
Matthew Hooker 2018-10-26 17:02:19 -07:00
parent e2a0cbf7df
commit 87c67eee94
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 53 additions and 45 deletions

View File

@ -1,7 +1,7 @@
---
description: |
The oracle-classic builder is able to create new custom images for use with Oracle
Cloud Infrastructure Classic Compute.
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'
@ -12,85 +12,92 @@ sidebar_current: 'docs-builders-oracle-classic'
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.
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)
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
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)
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.
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
- `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.
- `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
- `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` (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)
- `password` (string) - Your account password.
- `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).
- `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.
- `username` (string) - Your account username.
### Optional
- `attributes` (string) - (string) - Attributes to apply when launching the
- `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_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.
- `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
- `ssh_username` (string) - The username that Packer will use to SSH into the
instance; defaults to `opc`, the default oracle user, which has sudo
privileges. 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.
- `image_name` (string) - The name to assign to the resulting custom image.
- `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`
- `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`.
(minutes), and `h` (hours). Examples of valid inputs: `100ms`, `250ms`,
`1s`, `2.5s`, `2.5m`, `1m30s`. Example: `"snapshot_timeout": "15m"`.
Default: `20m`.
## Basic Example
@ -129,15 +136,16 @@ 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
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)
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
``` json
{
"userdata": {
"administrator_password": "password",
@ -146,10 +154,10 @@ Save this file as `windows_attributes.json`:
}
```
Following is a minimal but working Packer config that references this attributes
file:
Following is a minimal but working Packer config that references this
attributes file:
```json
``` json
{
"variables": {
"opc_username": "{{ env `OPC_USERNAME`}}",