# virsh command issue with ansible. launching command within $()

**URL:** <https://forum.ansible.com/t/virsh-command-issue-with-ansible-launching-command-within/16305>\
**Category:** Ansible Project\
**Created:** [September 23, 2014, 8:22am UTC](https://forum.ansible.com/t/virsh-command-issue-with-ansible-launching-command-within/16305 "2014-09-23T08:22:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Dodson](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alex\_Dodson](https://forum.ansible.com/u/Alex_Dodson)\
**Post date:** [September 23, 2014, 8:22am UTC](https://forum.ansible.com/t/virsh-command-issue-with-ansible-launching-command-within/16305/1 "2014-09-23T08:22:08Z")

</div>

Hello All,

I have a command to run. Here is a demo of it from the ceph doco

```auto
sudo virsh secret-set-value --secret 457eb676-33da-42ec-9a8c-9293d545c337 --base64 $(cat client.cinder.key)

when I try to shell: the command below the cat command within the $() doesnt run. It outputs in a specific format I can't quite match with tr so catting it normally and removing tabs and new lines does not work for me.

virsh secret-set-value --secret 457eb676-33da-42ec-9a8c-9293d545c337 --base64 $(cat client.cinder.key)

```

When I try to shell: the below to set it as a variable I get

```auto
$(cat client.cinder.key)

```

failed: [hostname] =\> {“changed”: true, “cmd”: “$(cat keyring)”, “delta”: “0:00:00.008503”, “end”: “2014-09-23 07:55:37.978874”, “rc”: 127, “start”: “2014-09-23 07:55:37.970371”}  
stderr: /bin/sh: [client.cinder]: command not found

[client.cinder] is the first line within the file I cat so for w/e reason it is trying to execute that it appears.

Any ideas how to stop that occuring?

thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [September 23, 2014, 7:08pm UTC](https://forum.ansible.com/t/virsh-command-issue-with-ansible-launching-command-within/16305/2 "2014-09-23T19:08:03Z")

</div>

Hi Alex, are you breaking this command up over multiple lines by any chance? With the current devel branch, the shell module will interpret newlines as the start of a new command to execute, so doing this:

- shell: |  
echo  
$(cat /path/to/foo)

will result in the contents of the file “foo” being executed similar to what you’re seeing above.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 23, 2014, 8:37pm UTC](https://forum.ansible.com/t/virsh-command-issue-with-ansible-launching-command-within/16305/3 "2014-09-23T20:37:53Z")

</div>

Might be good to share the playbook line where you are calling virsh?
