Inputs & Outputs

Command

Example

1
2
3
4
5
- ssh.client.run_command:
    command: ls --color=never -lsah
  load:
    ssh_server: ssh_server
  save: directory_listing
Required Keys

command: The command to run

Optional Keys

success: A regular expression matching the prompt when the command succeeds (defaults to the base_prompt)

questions: A list of CommandQuestion dictionaries (defaults to null)

CommandQuestion

  • Contains prompts and responses for questions asked by a command

  • You can supply as many of these questions & answers as you need to

  • Each question prompt must be unique per-command

  • Question prompts that aren't found are ignored

Question Handling

The following process is started if question prompt is found.

  1. The answer to the prompted question is sent
  2. If the response is in base_prompt or success, processing is complete
  3. Or if it's in another question prompt, go back to step 1

If a response isn't found in step 2 or 3 it will be treated as a failure.

Example

1
2
3
4
5
6
7
8
9
- ssh.client.run_commands:
    commands:
      - command: sudo ls --color=never -lsah
        questions:
          prompt: "\[sudo\] password for .*:"
          answer: "{{ ssh_server.password }}"
  load:
    ssh_server: ssh_server
  save: directory_listing
Required Keys

prompt: A regular expression matching the question prompt

answer: The command to run if the question is asked

SSHKeyAuth

  • Contains SSH connection details for key authentication

  • It is used as an input to many of the actions in this plugin

  • The example below shows the dictionary structure in YAML

Example

1
2
3
4
5
6
7
ssh_server:
  address: 1.2.3.4
  port: 22
  username: [username]
  private_key: [private_key_string]
  passphrase: [optional_passphrase]
  base_prompt: "ubuntu\-\d{3}#"

SSH Prompts

As of plugin version 1.1.0, if a base_prompt expression is not supplied, PPA will use the following:

^[a-zA-Z0-9\_\-]+@[a-zA-Z0-9\_\-]+:~\$\s+$

This expression supports the default Ubuntu SSH prompt in this format:

ubuntu@ip-172-30-23-5:~$

Supplying Credentials

You should always use a PPA Vault integration to provide credentials to a plugin action.

Required Keys

address: The target IP or DNS address.

username: Username for authentication.

private_key: RSA private key for authentication.

passphrase: The passphrase for the supplied private_key or null if not required.

Optional Keys

port: The target SSH port (defaults to 22)

base_prompt: Regular expression to match the SSH prompt (defaults to the standard Ubuntu SSH prompt format)

SSHPasswordAuth

  • Contains SSH connection details for password authentication

  • It is used as an input to many of the actions in this plugin

  • The example below shows the dictionary structure in YAML

Example

1
2
3
4
5
6
ssh_server:
  address: 1.2.3.4
  port: 22
  username: [username]
  password: [password]
  base_prompt: "ubuntu\-\d{3}#"

SSH Prompts

As of plugin version 1.1.0, if a base_prompt expression is not supplied, PPA will use the following:

^[a-zA-Z0-9\_\-]+@[a-zA-Z0-9\_\-]+:~\$\s+$

This expression supports the default Ubuntu SSH prompt in this format:

ubuntu@ip-172-30-23-5:~$

Supplying Credentials

You should always use a PPA Vault integration to provide credentials to a plugin action.

Required Keys

address: The target IP or DNS address.

username: Username for authentication.

password: Password for authentication.

Optional Keys

port: The target SSH port (defaults to 22)

base_prompt: Regular expression to match the SSH prompt (defaults to the standard Ubuntu SSH prompt format)

User

  • Contains Ubuntu user account information

Example

1
2
3
4
5
6
username: john_smith
uid: 2087
gid: 2087
description: John Smith
home_directory: "/home/john_smith"
login_shell: "/bin/bash"

User Keys

username: username

uid: user ID

gid: primary group ID

description: the contents of the GECOS field

home_directory: path to the user's home directory

login_shell: path to the user's login shell