# ssh to remote node and run CLI

**URL:** <https://forum.ansible.com/t/ssh-to-remote-node-and-run-cli/29024>\
**Category:** Ansible Project\
**Created:** [November 14, 2018, 2:10am UTC](https://forum.ansible.com/t/ssh-to-remote-node-and-run-cli/29024 "2018-11-14T02:10:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdul\_Rahim](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@Abdul\_Rahim](https://forum.ansible.com/u/Abdul_Rahim)\
**Post date:** [November 14, 2018, 2:10am UTC](https://forum.ansible.com/t/ssh-to-remote-node-and-run-cli/29024/1 "2018-11-14T02:10:49Z")

</div>

Hello Experts,

As you can see struggling through basic tasks will appreciate any pointers , using ansible version 2.7

cat inventory.yml  
fabric01:  
hosts:  
build\_node:  
build\_host: 192.168.115.101  
build\_username: root  
build\_password: 123Abdul123

root@ansibile-launch:~/ansible/tasks/add-compute# cat add-compute.yml

---

<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:** [November 14, 2018, 2:26am UTC](https://forum.ansible.com/t/ssh-to-remote-node-and-run-cli/29024/2 "2018-11-14T02:26:28Z")

</div>

Without an error I can only guess, one thing i've noticed is that you  
are incorrectly formatting the task

- name: return motd to registered var  
&nbsp;&nbsp;command: 'cp /root/setup\_data.yaml /root/setup\_data.yaml.bak'  
&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;ansible\_user= "{{build\_username}}"  
&nbsp;&nbsp;&nbsp;&nbsp;ansible\_ssh\_pass= "{{build\_password}}"

---

<div class="post-metadata">

**Author:** ![Abdul\_Rahim](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@Abdul\_Rahim](https://forum.ansible.com/u/Abdul_Rahim)\
**Post date:** [November 14, 2018, 2:55am UTC](https://forum.ansible.com/t/ssh-to-remote-node-and-run-cli/29024/3 "2018-11-14T02:55:52Z")

</div>

Thans Brian ,

It fails with following

root@ansibile-launch:~/ansible/tasks/add-compute# ansible-playbook -i inventory.yml add-compute.yml -vvvv  
ansible-playbook 2.7.1  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible-playbook  
python version = 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609]  
Using /etc/ansible/ansible.cfg as config file  
setting up inventory plugins  
/root/ansible/tasks/add-compute/inventory.yml did not meet host\_list requirements, check plugin documentation if this is unexpected  
/root/ansible/tasks/add-compute/inventory.yml did not meet script requirements, check plugin documentation if this is unexpected  
Parsed /root/ansible/tasks/add-compute/inventory.yml inventory source with yaml plugin  
ERROR! Syntax Error while loading YAML.  
mapping values are not allowed in this context

The error appears to have been in ‘/root/ansible/tasks/add-compute/add-compute.yml’: line 11, column 23, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Copy Test  
ansible\_user: “{{build\_username}}”  
^ here  
We could be wrong, but this one looks like it might be an issue with  
missing quotes. Always quote template expression brackets when they  
start a value. For instance:

with\_items:

- {{ foo }}

Should be written as:

with\_items:

- “{{ foo }}”

root@ansibile-launch:~/ansible/tasks/add-compute#

root@ansibile-launch:~/ansible/tasks/add-compute# cat add-compute.yml

---

<div class="post-metadata">

**Author:** ![vinod93pop](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@vinod93pop](https://forum.ansible.com/u/vinod93pop)\
**Post date:** [November 18, 2018, 6:47pm UTC](https://forum.ansible.com/t/ssh-to-remote-node-and-run-cli/29024/4 "2018-11-18T18:47:28Z")

</div>

Hi Abdul,

You could remove the hosts from inventory.ym , else directly mention it in default hosts inventory file

Br  
Vinoth
