> For the complete documentation index, see [llms.txt](https://docs.strongdm.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.strongdm.com/admin/deployment/scenarios/ansible.md).

# Ansible with SDM

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:

   ```ini
   [group_name]
   sdm_server_name ansible_port=sdm_ssh_port ansible_host=127.0.0.1
   ```

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

   ... then your inventory file should look like this.

   ```ini
   [sdm]
   bastion01 ansible_port=60672 ansible_host=127.0.0.1
   bastion02 ansible_port=61300 ansible_host=127.0.0.1
   deployment04 ansible_port=60834 ansible_host=127.0.0.1
   ```
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.

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

   bastion01 | SUCCESS | rc=0 >>
   hello

   bastion02 | SUCCESS | rc=0 >>
   hello
   ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.strongdm.com/admin/deployment/scenarios/ansible.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
