Overview

In general, a remote is identical to a server (e.g. Hetzner or EC2 VPS), but it can be any kind of device as long as you can SSH into it.

Defining a remote

In the inventory.yml file, you can define remotes like this.

remotes:
  one.hapideploy.com:
  two.hapideploy.com:
  three.hapideploy.com:

This case, one.hapideploy.com is a hostname for SSH connections. It's also the label displayed whenever a task is executed. It's similar to two.hapideploy.com and three.hapideploy.com. E.g., Running "hapi whoami --debug" will print this output.

[one.hapideploy.com] TASK whoami
[one.hapideploy.com] RUN whoami
[one.hapideploy.com] vagrant
[two.hapideploy.com] TASK whoami
[two.hapideploy.com] RUN whoami
[two.hapideploy.com] vagrant
[three.hapideploy.com] TASK whoami
[three.hapideploy.com] RUN whoami
[three.hapideploy.com] vagrant

Above, I assume each *.hapideploy.com is a host alias in ~/.ssh/config file. But, you can explicitly define a remote with a list of key-value pairs.

remotes:
  # hapideploy.com is the remote label.
  hapideploy.com:
    # SSH host(name)
    host: 192.68.33.10
    # SSH port
    port: 22
    # SSH user
    user: vagrant
    # The private key path
    identity_file: ~/.ssh/id_ed25519
    # The private key passphrase
    passphrase: 'a-secret-string'

Configuration override

Imagine, you've already defined deploy_path configuration in the deploy.py file.

from hapi.cli import app

app.put('deploy_path', '~/deploy')

You can override it using the with section under a remote item.

remotes:
  hapideploy.com:
    with:
      deploy_path: "/path/to/somewhere"

List remotes

You can list all defined remotes using the remote:list command

hapi remote:list
Previous
Configuration
Next
Tasks