# ssh connection for the hosts in dynamic inventory

**URL:** <https://forum.ansible.com/t/ssh-connection-for-the-hosts-in-dynamic-inventory/35080>\
**Category:** Ansible Project\
**Created:** [April 29, 2021, 9:53am UTC](https://forum.ansible.com/t/ssh-connection-for-the-hosts-in-dynamic-inventory/35080 "2021-04-29T09:53:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi\_Rathore](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sakshi\_Rathore](https://forum.ansible.com/u/Sakshi_Rathore)\
**Post date:** [April 29, 2021, 9:53am UTC](https://forum.ansible.com/t/ssh-connection-for-the-hosts-in-dynamic-inventory/35080/1 "2021-04-29T09:53:30Z")

</div>

hello all,

i have dynamically generated inventory like below, i want to establish ssh conenction to all the ips for istiotst and coremediaprod servers. I have ssh keys configured in the .ssh folder:  
when i run: ansible all -i inventory-ccp.ini -m ping  
i get connection ‘success’ only for istiotest but not for coremediaprod.

can anyone please advise me on this.

[istiotest:vars]  
ansible\_connection = ‘~/.ssh/istiotest’  
ansible\_user = ‘user\_name’

[coremediaprod:vars]  
ansible\_connection = ‘~/.ssh/coremediaprod’  
ansible\_user = ‘user\_name’

[ccpclusternodes]  
istiotest  
master-group  
user\_name  
10.32.142.184  
10.32.142.185  
10.32.142.186  
worker  
user\_name  
10.32.142.156  
10.32.142.153  
coremediaprod  
master-group  
user\_name  
10.32.31.166  
10.32.31.165  
10.32.31.167  
node-group  
user\_name  
10.32.31.170  
10.32.31.168  
10.32.31.169
