github.com/aspring/packer@v0.8.1-0.20150629211158-9db281ac0f89/website/source/docs/templates/communicator.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Templates: Communicators"
     4  description: |-
     5    Communicators are the mechanism Packer uses to upload files, execute scripts, etc. with the machine being created.
     6  ---
     7  
     8  # Templates: Communicators
     9  
    10  Communicators are the mechanism Packer uses to upload files, execute
    11  scripts, etc. with the machine being created.
    12  
    13  Communicators are configured within the [builder](/docs/templates/builders.html)
    14  section. Packer currently supports three kinds of communicators:
    15  
    16    * `none` - No communicator will be used. If this is set, most provisioners
    17        also can't be used.
    18  
    19    * `ssh` - An SSH connection will be established to the machine. This is
    20        usually the default.
    21  
    22    * `winrm` - A WinRM connection will be established.
    23  
    24  In addition to the above, some builders have custom communicators they can
    25  use. For example, the Docker builder has a "docker" communicator that uses
    26  `docker exec` and `docker cp` to execute scripts and copy files.
    27  
    28  ## Using a Communicator
    29  
    30  By default, the SSH communicator is usually used. Additional configuration
    31  may not even be necesssary, since some builders such as Amazon automatically
    32  configure everything.
    33  
    34  However, to specify a communicator, you set the `communicator` key within
    35  a build. Multiple builds can have different communicators. Example:
    36  
    37  ```javascript
    38  {
    39      "builders": [{
    40          "type": "amazon-ebs",
    41          "communicator": "ssh"
    42      }]
    43  }
    44  ```
    45  
    46  After specifying the `communicator`, you can specify a number of other
    47  configuration parameters for that communicator. These are documented below.
    48  
    49  ## SSH Communicator
    50  
    51  The SSH communicator connects to the host via SSH. If you have an SSH
    52  agent enabled on the machine running Packer, it will automatically forward
    53  the SSH agent to the remote host.
    54  
    55  The SSH communicator has the following options:
    56  
    57    * `ssh_host` (string) - The address to SSH to. This usually is automatically
    58      configured by the builder.
    59  
    60    * `ssh_port` (int) - The port to connect to SSH. This defaults to 22.
    61  
    62    * `ssh_username` (string) - The username to connect to SSH with.
    63  
    64    * `ssh_password` (string) - A plaintext password to use to authenticate
    65      with SSH.
    66  
    67    * `ssh_private_key_file` (string) - Path to a PEM encoded private key
    68      file to use to authentiate with SSH.
    69  
    70    * `ssh_pty` (bool) - If true, a PTY will be requested for the SSH connection.
    71      This defaults to false.
    72  
    73    * `ssh_timeout` (string) - The time to wait for SSH to become available.
    74      Packer uses this to determine when the machine has booted so this is usually
    75      quite long. Example value: "10m"
    76  
    77    * `ssh_handshake_attempts` (int) - The number of handshakes to attempt with
    78      SSH once it can connect. This defaults to 10.
    79  
    80    * `ssh_disable_agent` (bool) - If true, SSH agent forwarding will be disabled.
    81  
    82    * `ssh_bastion_host` (string) - A bastion host to use for the actual
    83      SSH connection.
    84  
    85    * `ssh_bastion_port` (int) - The port of the bastion host. Defaults to 22.
    86  
    87    * `ssh_bastion_username` (string) - The username to connect to the bastion host.
    88  
    89    * `ssh_bastion_password` (string) - The password to use to authenticate
    90      with the bastion host.
    91  
    92    * `ssh_bastion_private_key_file` (string) - A private key file to use
    93      to authenticate with the bastion host.
    94  
    95  ## WinRM Communicator
    96  
    97  The WinRM communicator has the following options.
    98  
    99    * `winrm_host` (string) - The address for WinRM to connect to.
   100  
   101    * `winrm_port` (int) - The WinRM port to connect to. This defaults to 5985.
   102  
   103    * `winrm_username` (string) - The username to use to connect to WinRM.
   104  
   105    * `winrm_password` (string) - The password to use to connect to WinRM.
   106  
   107    * `winrm_timeout` (string) - The amount of time to wait for WinRM to
   108      become available. This defaults to "30m" since setting up a Windows
   109      machine generally takes a long time.