Overview

Date: 2026-05-11

Time: 15:48

Overview

This is an example script demonstrating ping() — FTL2's connectivity verification module. It tests the full execution pipeline (TCP → SSH → Gate setup → Command execution → Response round-trip). When ping() succeeds, module execution is guaranteed to work. The file serves as both documentation and runnable reference for common ping patterns.

Usage Patterns

Basic local ping:


async with automation(quiet=True) as ftl:
    result = await ftl.local.ping()       # {'ping': 'pong'}

FQCN (Ansible-style) module name:


result = await ftl.local.ansible.builtin.ping()

Remote host ping (via inventory):


result = await ftl.web01.ping()

Pre-flight connectivity check before work:


try:
    await ftl.db_primary.ping()
    # safe to proceed with operations
except TimeoutError:
    # handle unreachable host

Post-provisioning readiness check:


ftl.add_host("new-server", ansible_host=ip, ansible_user="root", groups=["webservers"])
await ftl.new_server.wait_for_ssh(timeout=120, delay=10)
result = await ftl.new_server.ping()

API and Configuration

Key Behaviors

Relationships