12 · Ansible
12 · Operate

Ansible

Run the same command on several servers at once and view the per-server results together. There is no confirmation dialog before a run, so read the cautions in this chapter first.

Layout of the Ansible view

Press Ansible in the Navigation rail to open it. Choose servers and connect on the left; run commands and view results on the right.

  1. Servers

    Choose servers from the list of scanned instances.

  2. Connection buttons

    Connect, Test connection, Disconnect all.

  3. Command input

    Contains the command to run and the sudo, Timeout and Run buttons.

  4. Results

    Per-server success or failure and output stack up as cards.

This view is a tool for batch-running shell commands over SSH. Despite its name, it does not run Ansible playbooks, inventories or modules.

Ansible does not need to be installed on either the PC or the servers.

In this chapter, the instances in the list are called hosts, as they are labeled on screen.

Host list

Servers lists only instances whose status in the scan result is ACTIVE. Stopped instances and manual instances are not listed.

  1. Servers

    The total number in the list and the number connected now (N connected).

  2. Filter and selection

    Narrow the list with Filter by name or IP. Select all selects or clears everything; Select connected selects only connected hosts.

  3. Configured host

    Click a row to select it and click again to clear it. The dot is gray (not connected), orange (connecting) or green (connected), with IP:Port and the response time below.

  4. Failed host

    Shows a red dot and the beginning of the error message. Hover over the row to see the full message.

  5. Not configured

    A host with no saved SSH settings. Clicking the row does not select it; the SSH settings dialog opens instead.

  6. Bottom buttons

    Connect N hosts, Test connection, Disconnect all. Connect is off when no host is selected.

SSH settings dialog

A Not configured host can be selected only after its connection settings are saved once. Instances already saved in Terminal can be selected right away.

  1. Press Configure

    Clicking the row of a Not configured host or its Configure button opens the SSH settings dialog. The host name and IP are shown below the title.

  2. Fill in Connection

    User is required. Port is prefilled with 22.

  3. Choose Authentication

    If Method is Key, choose a registered key in Key profile; if it is Password, enter the password. Keys are registered in Terminal. (chapter 6)

  4. Press Save

    If a value is missing, Username is required, Select a key profile or Password is required is shown. Once saved, the host can be selected.

  5. To edit later

    This dialog does not open for a host that is already configured. Open that instance's connection dialog from the Instances panel in Terminal and edit it there. (chapter 7)

Connect, test, disconnect

Commands run only on connected hosts. Choose hosts first and connect them with Connect.

  • CONNECT

    Connect N hosts

    Connects to the selected hosts over SSH. Up to 10 hosts are connected at the same time.

    Connection settings are looked up in this order.

    • Settings saved for the selected IP
    • Settings saved for that instance
    • SSH default settings (the port is 22 in this case)

    If the user name is empty, it is guessed from the image name (ubuntu, rocky and so on); if it cannot be determined, root is used.

  • ROUTE / TEST

    Routes and Test connection

    • If the instance and IP are registered as a target of a Jump server, the connection goes through that Jump server. DNAT mapping is not used. (chapter 7)
    • Test connection checks only the connected hosts among those selected. The response time is shown as, for example, 18ms; a host that does not respond changes to failed.
  • DISCONNECT

    Disconnect all

    • Ends every connection with no confirmation dialog. There is no way to disconnect only chosen hosts.
    • Switching to another project disconnects everything automatically.
    • Connections and results remain when you move to another view and come back.
    • These connections are separate from Terminal session tabs.

Writing and running a command

Type a command and press Run; it runs simultaneously on every host that is both selected and connected. Up to 20 hosts run at a time.

  1. Command field

    Type the shell command to run. Ctrl+Enter also runs it.

  2. sudo

    When on, sudo -n is prepended to the command. It fails for accounts that are asked for a password.

  3. Timeout

    30s, 60s (default), 120s, 300s. Hosts that exceed it are marked Timeout.

  4. Selection status

    The number of run targets. With no targets, No connected hosts selected is shown.

  5. Run on N hosts

    Runs the command. During a run it changes to Running… and cannot be pressed again.

Viewing results

A result card is added as each host finishes. Cards appear collapsed; click one to expand its output.

  1. Summary

    The Success, Failed and Timeout counts, the host count and the elapsed time. During a run, Running and N completed are shown.

  2. Expand all / Collapse all

    Expands or collapses all cards at once.

  3. Executed command

    The command actually sent to the servers. With sudo on, it appears with sudo -n prepended.

  4. Host card

    Shows the status, name, IP, exit code and elapsed time. The button on the right (Copy output) copies the output and errors to the clipboard.

  5. Failed host

    Click stderr (N lines) to expand the error output. With no output at all, No output is shown.

Records sent to the central audit serverOff in the current version

What you connect to and run in the Ansible view is sent to the central audit server as audit records. It is sent even when you are not connected to the Central gateway.

ActionWhat is sent
Common to all recordsPC name (host name), action type, success or failure
ConnectOne record per host: target IP and instance name. On failure, the error message
Test connectionHost count, per-host ID and connection state
RunThe full command that was run (including sudo -n), host count, success count and failure count. If the run itself fails, the error details
Disconnect allOne record per host that was connected: IP and instance name
What is not sentCommand output (stdout, stderr), SSH passwords and keys