Ansible with SDM

Last modified on March 24, 2023

  1. Install the SDM ssh aliases by adding the output of sdm ssh alias to your .bashrc file or running directly on the command line.

  2. Create an Ansible inventory file with the following format:

    sdm_server_name ansible_port=sdm_ssh_port ansible_host=

    For example, if you have the following SSH servers configured…

    … then your inventory file should look like this.

    bastion01 ansible_port=60672 ansible_host=
    bastion02 ansible_port=61300 ansible_host=
    deployment04 ansible_port=60834 ansible_host=
  3. Connect to the servers you want to access using sdm: either click on each one in the UI and ensure the green lightning bolt icon is visible next to each, or run sdm connect sdm_server_name for each (or sdm connect --all).

  4. Run Ansible using that inventory file.

    $ ansible -i ansibleinventory sdm -a "echo hello"
    deployment04 | SUCCESS | rc=0 >>
    bastion01 | SUCCESS | rc=0 >>
    bastion02 | SUCCESS | rc=0 >>