github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/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
    56  agent enabled on the machine running Packer, it will automatically forward
    57  the SSH agent to the remote host.
    58  
    59  The SSH communicator has the following options:
    60  
    61  -   `ssh_bastion_agent_auth` (boolean) - If true, the local SSH agent will
    62      be used to authenticate with the bastion host. Defaults to false.
    63  
    64  -   `ssh_bastion_host` (string) - A bastion host to use for the actual
    65      SSH connection.
    66  
    67  -   `ssh_bastion_password` (string) - The password to use to authenticate
    68      with the bastion host.
    69  
    70  -   `ssh_bastion_port` (integer) - The port of the bastion host. Defaults to 1.  
    71  
    72  -   `ssh_bastion_private_key_file` (string) - A private key file to use
    73      to authenticate with the bastion host.
    74  
    75  -   `ssh_bastion_username` (string) - The username to connect to the bastion
    76      host.
    77  
    78  -   `ssh_disable_agent_forwarding` (boolean) - If true, SSH agent forwarding
    79      will be disabled. Defaults to false.
    80  
    81  -   `ssh_file_transfer_method` (`scp` or `sftp`) - How to transfer files, Secure
    82      copy (default) or SSH File Transfer Protocol.
    83  
    84  -   `ssh_handshake_attempts` (integer) - The number of handshakes to attempt
    85      with SSH once it can connect. This defaults to 10.
    86  
    87  -   `ssh_host` (string) - The address to SSH to. This usually is automatically
    88      configured by the builder.
    89  
    90  -   `ssh_password` (string) - A plaintext password to use to authenticate
    91      with SSH.
    92  
    93  -   `ssh_port` (integer) - The port to connect to SSH. This defaults to 22.
    94  
    95  -   `ssh_private_key_file` (string) - Path to a PEM encoded private key
    96      file to use to authenticate with SSH.
    97  
    98  -   `ssh_pty` (boolean) - If true, a PTY will be requested for the SSH
    99      connection. This defaults to false.
   100  
   101  -   `ssh_timeout` (string) - The time to wait for SSH to become available.
   102      Packer uses this to determine when the machine has booted so this is
   103      usually quite long. Example value: "10m"
   104  
   105  -   `ssh_username` (string) - The username to connect to SSH with. Required
   106      if using SSH.
   107  
   108  ## WinRM Communicator
   109  
   110  The WinRM communicator has the following options.
   111  
   112  -   `winrm_host` (string) - The address for WinRM to connect to.
   113  
   114  -   `winrm_port` (integer) - The WinRM port to connect to. This defaults to
   115      5985 for plain unencrypted connection and 5986 for SSL when `winrm_use_ssl` is set to true.
   116  
   117  -   `winrm_username` (string) - The username to use to connect to WinRM.
   118  
   119  -   `winrm_password` (string) - The password to use to connect to WinRM.
   120  
   121  -   `winrm_timeout` (string) - The amount of time to wait for WinRM to
   122      become available. This defaults to "30m" since setting up a Windows
   123      machine generally takes a long time.
   124  
   125  -   `winrm_use_ssl` (boolean) - If true, use HTTPS for WinRM
   126  
   127  -   `winrm_insecure` (boolean) - If true, do not check server certificate
   128      chain and host name
   129  
   130  -   `winrm_use_ntlm` (boolean) - If true, NTLM authentication will be used for WinRM,
   131      rather than default (basic authentication), removing the requirement for basic
   132      authentication to be enabled within the target guest. Further reading for remote
   133      connection authentication can be found [here](https://msdn.microsoft.com/en-us/library/aa384295(v=vs.85).aspx).