# running a raw command?

**URL:** <https://forum.ansible.com/t/running-a-raw-command/11754>\
**Category:** Ansible Project\
**Created:** [August 2, 2012, 8:49pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754 "2012-08-02T20:49:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [August 2, 2012, 8:49pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/1 "2012-08-02T20:49:01Z")

</div>

Hi,  
I'm running a raw command as in the document and I just get the  
ansible usages options. I tried these various commands. Is there any  
useful output to post here? I also tried command with a straight host  
name.

sheepchase:library jmarcus$ ansible --version  
ansible 0.6

ansible cl400 raw -a "yum install python-simplejson" -u jmarcus -K -f 1  
ansible cl400 raw -a "yum install python-simplejson" -u jmarcus -K -f 1 -v  
ansible CL400 raw -a "yum install python-simplejson" -u jmarcus -K -f 1 -v  
ansible cl400 raw -a "yum install python-simplejson"

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 2, 2012, 9:02pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/2 "2012-08-02T21:02:32Z")

</div>

raw command should show output, I'll look into it later on tonight.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 2, 2012, 9:03pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/3 "2012-08-02T21:03:29Z")

</div>

[https://github.com/ansible/ansible/issues/775](https://github.com/ansible/ansible/issues/775)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 3, 2012, 12:41am UTC](https://forum.ansible.com/t/running-a-raw-command/11754/4 "2012-08-03T00:41:29Z")

</div>

The problem was you forgot the "-m" in front of the RAW module, so it  
was running the default module, which is command. This gives me a  
usage error on my development build, though it might not in older  
ansible versions.

Anyway, try "-m raw"

---

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [August 3, 2012, 2:11pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/5 "2012-08-03T14:11:06Z")

</div>

Hi,  
I was able to run: ansible CL400 -m raw -a "yum install  
python-simplejson" -u jmarcus -K  
I found the command without the -m on this page:  
[http://ansible.github.com/modules.html](http://ansible.github.com/modules.html)

The first time a ran it, it command hung and I'm not if it was a bad  
password or something else:  
Not sure if this output is helpful:

cl404.test.net | success | rc=0 \>\>

Sorry, try again.

[sudo via ansible, key=glktgjrppzslvvgkgskoclplmnsqnenn] password:

sudo: 1 incorrect password attempt

cl402.test.net | success | rc=0 \>\>

When I ran it again, it worked.

But I have another question per the documentation where I got the raw  
command. It says:  
ansible newhost.example.com raw -a "yum install python-simplejson"

So on another host I tried ansible IPAddr -m raw -a "yum install  
python-simplejson" and it failed, is there a switch for just running  
on one host?

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 3, 2012, 2:14pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/6 "2012-08-03T14:14:55Z")

</div>

If you feed things a bad sudo password the sudo code can hang.

Not really anything we can do about that.

Typo in docs needs to be fixed.

> Hi,
> 
> But I have another question per the documentation where I got the raw  
> command. It says:  
> ansible [newhost.example.com](http://newhost.example.com) raw -a “yum install python-simplejson”
> 
> So on another host I tried ansible IPAddr -m raw -a “yum install  
> python-simplejson” and it failed, is there a switch for just running  
> on one host?

Failed is confusing. Failed how? What sort of message did you get?

It is likely that your hostname or IP isn’t in your inventory file.

---

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [August 3, 2012, 2:18pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/7 "2012-08-03T14:18:31Z")

</div>

Yes the host wasn't in the hosts file and it returned with that  
message. I thought you might be able to run it without it being in  
the hosts file.

sorry for not more adding more detail there.

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 3, 2012, 2:21pm UTC](https://forum.ansible.com/t/running-a-raw-command/11754/8 "2012-08-03T14:21:39Z")

</div>

> Yes the host wasn't in the hosts file and it returned with that  
> message. I thought you might be able to run it without it being in  
> the hosts file.

You can.

Do -i "192.168.10.15," # the comma is very important even if you  
specify only one host.

Need to work on the syntax of this, as it's a little weird, but hey, it's there.
