# How to specify a host variable as the SSH target

**URL:** <https://forum.ansible.com/t/how-to-specify-a-host-variable-as-the-ssh-target/44369>\
**Category:** Get Help\
**Tags:** cisco, dns, aap\
**Created:** [August 25, 2025, 5:58pm UTC](https://forum.ansible.com/t/how-to-specify-a-host-variable-as-the-ssh-target/44369 "2025-08-25T17:58:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xkevin](https://avatars.discourse-cdn.com/v4/letter/0/7c8e57/32.png) [@0xkevin](https://forum.ansible.com/u/0xkevin)\
**Post date:** [August 25, 2025, 5:58pm UTC](https://forum.ansible.com/t/how-to-specify-a-host-variable-as-the-ssh-target/44369/1 "2025-08-25T17:58:58Z")

</div>

Hi all, I am having difficulty finding information on how to tell Ansible Automation Platform to use one of the host variables as the SSH target.

So for example, I have a host in an inventory in Ansible Automation Platform like this:

 ![{43532C04-6CA5-4E1A-B8CD-74620E1EFA0C}](https://us1.discourse-cdn.com/ansible/original/2X/e/ede051b1db08f7f3c554f7a33784d51b9261a242.png)

The host name is ‘glccd-alsip-dc-sw2’. The variables associated with this host are the following:

```auto
{
  "ip_address": "10.10.10.10",
  "manufacturer": "Cisco Systems, Inc.",
  "name": "glccd-alsip-dc-sw2",
  "short_description": "Cisco IOS Software ......."
}

```

How do I tell Ansible Automation Platform to not try and resolve ‘glccd-alsip-dc-sw2’ to an IP address but to use the IP address in the host variable? Not every host has an valid A-record, and so when AAP tries to resolve the host name, it fails. Is this possible to do before execution time or at runtime? And how can it be done?

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [August 25, 2025, 7:37pm UTC](https://forum.ansible.com/t/how-to-specify-a-host-variable-as-the-ssh-target/44369/2 "2025-08-25T19:37:57Z")

</div>

You just need to set the ssh connection plugin configuration to know that ip\_address is how to reach your target, one way:

```auto
ansible_ssh_host: '{{ip_address}}'

```

---

<div class="post-metadata">

**Author:** ![0xkevin](https://avatars.discourse-cdn.com/v4/letter/0/7c8e57/32.png) [@0xkevin](https://forum.ansible.com/u/0xkevin)\
**Post date:** [August 25, 2025, 8:41pm UTC](https://forum.ansible.com/t/how-to-specify-a-host-variable-as-the-ssh-target/44369/3 "2025-08-25T20:41:59Z")

</div>

Marking this as the solution as specifying ‘ansible\_host:’ with the IP address fixed it. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 24, 2025, 8:42pm UTC](https://forum.ansible.com/t/how-to-specify-a-host-variable-as-the-ssh-target/44369/4 "2025-09-24T20:42:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
