github.com/raghuse92/packer@v1.3.2/website/source/docs/builders/oracle-classic.html.md (about) 1 --- 2 description: | 3 The oracle-classic builder is able to create new custom images for use with Oracle 4 Cloud Infrastructure Classic Compute. 5 layout: docs 6 page_title: 'Oracle Cloud Infrastructure Classic - Builders' 7 sidebar_current: 'docs-builders-oracle-classic' 8 --- 9 10 # Oracle Cloud Infrastructure Classic Compute Builder 11 12 Type: `oracle-classic` 13 14 The `oracle-classic` Packer builder is able to create custom images for use 15 with [Oracle Cloud Infrastructure Classic Compute](https://cloud.oracle.com/compute-classic). The builder 16 takes a base image, runs any provisioning necessary on the base image after 17 launching it, and finally snapshots it creating a reusable custom image. 18 19 It is recommended that you familiarise yourself with the 20 [Key Concepts and Terminology](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/terminology.html) 21 prior to using this builder if you have not done so already. 22 23 The builder _does not_ manage images. Once it creates an image, it is up to you 24 to use it or delete it. 25 26 ## Authorization 27 28 This builder authenticates API calls to Oracle Cloud Infrastructure Classic Compute using basic 29 authentication (user name and password). 30 To read more, see the [authentication documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/Authentication.html) 31 32 ## Configuration Reference 33 34 There are many configuration options available for the `oracle-classic` builder. 35 This builder currently only works with the SSH communicator. 36 37 ### Required 38 39 - `api_endpoint` (string) - This is your custom API endpoint for sending 40 requests. Instructions for determining your API endpoint can be found 41 [here](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/SendRequests.html) 42 43 - `dest_image_list` (string) - Where to save the machine image to once you've 44 provisioned it. If the provided image list does not exist, Packer will create it. 45 46 - `identity_domain` (string) - This is your customer-specific identity domain 47 as generated by Oracle. If you don't know what your identity domain is, ask 48 your account administrator. For a little more information, see the Oracle 49 [documentation](https://docs.oracle.com/en/cloud/get-started/subscriptions-cloud/ocuid/identity-domain-overview.html#GUID-7969F881-5F4D-443E-B86C-9044C8085B8A). 50 51 - `source_image_list` (string) - This is what image you want to use as your base image. 52 See the [documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/listing-machine-images.html) 53 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 54 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) 55 56 - `password` (string) - Your account password. 57 58 - `shape` (string) - The template that determines the number of 59 CPUs, amount of memory, and other resources allocated to a newly created 60 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). 61 62 - `username` (string) - Your account username. 63 64 ### Optional 65 66 - `attributes` (string) - (string) - Attributes to apply when launching the 67 instance. Note that you need to be careful about escaping characters due to 68 the templates being JSON. It is often more convenient to use 69 `attributes_file`, instead. You may only define either `attributes` or 70 `attributes_file`, not both. 71 72 - `attributes_file` (string) - Path to a json file that will be used for the 73 attributes when launching the instance. You may only define either 74 `attributes` or `attributes_file`, not both. 75 76 - `image_description` (string) - a description for your destination 77 image list. If you don't provide one, Packer will provide a generic description. 78 79 - `ssh_username` (string) - The username that Packer will use to SSH into the 80 instance; defaults to `opc`, the default oracle user, which has sudo 81 privileges. If you have already configured users on your machine, you may 82 prompt Packer to use one of those instead. For more detail, see the 83 [documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/accessing-oracle-linux-instance-using-ssh.html). 84 85 - `image_name` (string) - The name to assign to the resulting custom image. 86 87 - `snapshot_timeout` (string) - How long to wait for a snapshot to be 88 created. Expects a positive golang Time.Duration string, which is 89 a sequence of decimal numbers and a unit suffix; valid suffixes are `ns` 90 (nanoseconds), `us` (microseconds), `ms` (milliseconds), `s` (seconds), `m` 91 (minutes), and `h` (hours). Examples of valid inputs: `100ms`, `250ms`, `1s`, 92 `2.5s`, `2.5m`, `1m30s`. 93 Example: `"snapshot_timeout": "15m"`. Default: `20m`. 94 95 ## Basic Example 96 97 Here is a basic example. Note that account specific configuration has been 98 obfuscated; you will need to add a working `username`, `password`, 99 `identity_domain`, and `api_endpoint` in order for the example to work. 100 101 ``` json 102 { 103 "builders": [ 104 { 105 "type": "oracle-classic", 106 "username": "myuser@myaccount.com", 107 "password": "supersecretpasswordhere", 108 "identity_domain": "#######", 109 "api_endpoint": "https://api-###.compute.###.oraclecloud.com/", 110 "source_image_list": "/oracle/public/OL_7.2_UEKR4_x86_64", 111 "shape": "oc3", 112 "image_name": "Packer_Builder_Test_{{timestamp}}", 113 "attributes": "{\"userdata\": {\"pre-bootstrap\": {\"script\": [\"...\"]}}}", 114 "dest_image_list": "Packer_Builder_Test_List" 115 } 116 ], 117 "provisioners": [ 118 { 119 "type": "shell", 120 "inline": ["echo hello"] 121 } 122 ] 123 } 124 ``` 125 126 ## Basic Example -- Windows 127 128 Attributes file is optional for connecting via ssh, but required for winrm. 129 130 The following file contains the bare minimum necessary to get winRM working; 131 you have to give it the password to give to the "Administrator" user, which 132 will be the one winrm connects to. You must also whitelist your computer 133 to connect via winRM -- the empty braces below whitelist any computer to access 134 winRM but you can make it more secure by only allowing your build machine 135 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) 136 for more details on how to define a trusted host. 137 138 Save this file as `windows_attributes.json`: 139 140 ```json 141 { 142 "userdata": { 143 "administrator_password": "password", 144 "winrm": {} 145 } 146 } 147 ``` 148 149 Following is a minimal but working Packer config that references this attributes 150 file: 151 152 ```json 153 { 154 "variables": { 155 "opc_username": "{{ env `OPC_USERNAME`}}", 156 "opc_password": "{{ env `OPC_PASSWORD`}}", 157 "opc_identity_domain": "{{env `OPC_IDENTITY_DOMAIN`}}", 158 "opc_api_endpoint": "{{ env `OPC_ENDPOINT`}}" 159 }, 160 "builders": [ 161 { 162 "type": "oracle-classic", 163 "username": "{{ user `opc_username`}}", 164 "password": "{{ user `opc_password`}}", 165 "identity_domain": "{{ user `opc_identity_domain`}}", 166 "api_endpoint": "{{ user `opc_api_endpoint`}}", 167 "source_image_list": "/Compute-{{ user `opc_identity_domain` }}/{{ user `opc_username`}}/Microsoft_Windows_Server_2012_R2-17.3.6-20170930-124649", 168 "attributes_file": "./windows_attributes.json", 169 "shape": "oc3", 170 "image_name": "Packer_Windows_Demo_{{timestamp}}", 171 "dest_image_list": "Packer_Windows_Demo", 172 "communicator": "winrm", 173 "winrm_username": "Administrator", 174 "winrm_password": "password" 175 } 176 ], 177 "provisioners": [ 178 { 179 "type": "powershell", 180 "inline": "Write-Output(\"HELLO WORLD\")" 181 } 182 ] 183 } 184 ```