Ansible

How to use Ansible with Synpse

Synpse supports native SSH access. More on this can be found in Synpse documentation.

This means you can SSH to edge devices, even if they are behind CGNAT or without external IP address. In addition Synpse CLI can produce Ansible compatible inventory list!

Configure Synpse CLI with SSH keys:

synpse ssh-keys configure

Create a dynamic inventory wrapper script synpse_inventory.sh:

#!/bin/bash

#  Add filtering if you want to target certain devices
synpse devices list -o ansible # -f status=online

Use this script with the ansible command:

ansible -i synpse_inventory.sh all -m ping
beagleboardai | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "ping": "pong"
} 
rpi4 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.8"
    },
    "changed": false,
    "ping": "pong"
}
rpi3 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.8"
    },
    "changed": false,
    "ping": "pong"
}

Last updated