github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/website/source/docs/templates/communicator.html.md (about) 1 --- 2 description: | 3 Communicators are the mechanism Packer uses to upload files, execute scripts, 4 etc. with the machine being created. 5 layout: docs 6 page_title: 'Communicators - Templates' 7 sidebar_current: 'docs-templates-communicators' 8 --- 9 10 # Template Communicators 11 12 Communicators are the mechanism Packer uses to upload files, execute 13 scripts, etc. with the machine being created. 14 15 Communicators are configured within the [builder](/docs/templates/builders.html) 16 section. Packer currently supports three kinds of communicators: 17 18 - `none` - No communicator will be used. If this is set, most provisioners 19 also can't be used. 20 21 - `ssh` - An SSH connection will be established to the machine. This is 22 usually the default. 23 24 - `winrm` - A WinRM connection will be established. 25 26 In addition to the above, some builders have custom communicators they can 27 use. For example, the Docker builder has a "docker" communicator that uses 28 `docker exec` and `docker cp` to execute scripts and copy files. 29 30 ## Using a Communicator 31 32 By default, the SSH communicator is usually used. Additional configuration 33 may not even be necessary, since some builders such as Amazon automatically 34 configure everything. 35 36 However, to specify a communicator, you set the `communicator` key within 37 a build. Multiple builds can have different communicators. Example: 38 39 ``` json 40 { 41 "builders": [ 42 { 43 "type": "amazon-ebs", 44 "communicator": "ssh" 45 } 46 ] 47 } 48 ``` 49 50 After specifying the `communicator`, you can specify a number of other 51 configuration parameters for that communicator. These are documented below. 52 53 ## SSH Communicator 54 55 The SSH communicator connects to the host via SSH. If you have an SSH agent 56 configured on the host running Packer, and SSH agent authentication is enabled 57 in the communicator config, Packer will automatically forward the SSH agent 58 to the remote host. 59 60 The SSH communicator has the following options: 61 62 - `ssh_agent_auth` (boolean) - If `true`, the local SSH agent will be used to 63 authenticate connections to the remote host. Defaults to `false`. 64 65 - `ssh_bastion_agent_auth` (boolean) - If `true`, the local SSH agent will 66 be used to authenticate with the bastion host. Defaults to `false`. 67 68 - `ssh_bastion_host` (string) - A bastion host to use for the actual 69 SSH connection. 70 71 - `ssh_bastion_password` (string) - The password to use to authenticate 72 with the bastion host. 73 74 - `ssh_bastion_port` (number) - The port of the bastion host. Defaults to `1`. 75 76 - `ssh_bastion_private_key_file` (string) - A private key file to use 77 to authenticate with the bastion host. 78 79 - `ssh_bastion_username` (string) - The username to connect to the bastion 80 host. 81 82 - `ssh_disable_agent_forwarding` (boolean) - If true, SSH agent forwarding 83 will be disabled. Defaults to `false`. 84 85 - `ssh_file_transfer_method` (`scp` or `sftp`) - How to transfer files, Secure 86 copy (default) or SSH File Transfer Protocol. 87 88 - `ssh_handshake_attempts` (number) - The number of handshakes to attempt 89 with SSH once it can connect. This defaults to `10`. 90 91 - `ssh_host` (string) - The address to SSH to. This usually is automatically 92 configured by the builder. 93 94 * `ssh_keep_alive_interval` (string) - How often to send "keep alive" 95 messages to the server. Set to a negative value (`-1s`) to disable. Example 96 value: `10s`. Defaults to `5s`. 97 98 - `ssh_password` (string) - A plaintext password to use to authenticate 99 with SSH. 100 101 - `ssh_port` (number) - The port to connect to SSH. This defaults to `22`. 102 103 - `ssh_private_key_file` (string) - Path to a PEM encoded private key 104 file to use to authenticate with SSH. 105 106 - `ssh_proxy_host` (string) - A SOCKS proxy host to use for SSH connection 107 108 - `ssh_proxy_password` (string) - The password to use to authenticate with 109 the proxy server. Optional. 110 111 - `ssh_proxy_port` (number) - A port of the SOCKS proxy. Defaults to `1080`. 112 113 - `ssh_proxy_username` (string) - The username to authenticate with the proxy 114 server. Optional. 115 116 - `ssh_pty` (boolean) - If `true`, a PTY will be requested for the SSH 117 connection. This defaults to `false`. 118 119 * `ssh_read_write_timeout` (string) - The amount of time to wait for a remote 120 command to end. This might be useful if, for example, packer hangs on 121 a connection after a reboot. Example: `5m`. Disabled by default. 122 123 - `ssh_timeout` (string) - The time to wait for SSH to become available. 124 Packer uses this to determine when the machine has booted so this is 125 usually quite long. Example value: `10m`. 126 127 - `ssh_username` (string) - The username to connect to SSH with. Required 128 if using SSH. 129 130 ## WinRM Communicator 131 132 The WinRM communicator has the following options. 133 134 - `winrm_host` (string) - The address for WinRM to connect to. 135 136 - `winrm_insecure` (boolean) - If `true`, do not check server certificate 137 chain and host name. 138 139 - `winrm_password` (string) - The password to use to connect to WinRM. 140 141 - `winrm_port` (number) - The WinRM port to connect to. This defaults to 142 `5985` for plain unencrypted connection and `5986` for SSL when 143 `winrm_use_ssl` is set to true. 144 145 - `winrm_timeout` (string) - The amount of time to wait for WinRM to 146 become available. This defaults to `30m` since setting up a Windows 147 machine generally takes a long time. 148 149 - `winrm_use_ntlm` (boolean) - If `true`, NTLM authentication will be used for WinRM, 150 rather than default (basic authentication), removing the requirement for basic 151 authentication to be enabled within the target guest. Further reading for remote 152 connection authentication can be found [here](https://msdn.microsoft.com/en-us/library/aa384295(v=vs.85).aspx). 153 154 - `winrm_use_ssl` (boolean) - If `true`, use HTTPS for WinRM. 155 156 - `winrm_username` (string) - The username to use to connect to WinRM.