# ans-command

**URL:** <https://forum.ansible.com/t/ans-command/11427>\
**Category:** Ansible Project\
**Tags:** fedora\
**Created:** [April 19, 2012, 9:01pm UTC](https://forum.ansible.com/t/ans-command/11427 "2012-04-19T21:01:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [April 19, 2012, 9:01pm UTC](https://forum.ansible.com/t/ans-command/11427/1 "2012-04-19T21:01:14Z")

</div>

In the process of working on some other scripts I hacked this up as a test of a pretty simple ansible script. It is more or less a duplicate of func-command.

[http://fedorapeople.org/gitweb?p=skvidal/public\_git/scripts.git;a=tree;f=ansible/ans-command](http://fedorapeople.org/gitweb?p=skvidal/public_git/scripts.git;a=tree;f=ansible/ans-command)

ans-command uptime

runs uptime on all the boxes in the default inventory.

ans-command --host="host1" --host="@groupspec" "uname -a"

runs uname -a on host1 and all the hosts matching the groupspec.

We use func-command daily in fedora infrastructure and this lets us migrate to using ansible w/o having to relearn syntax.

I've also updated host-reboot to work with the new inventory api

[http://fedorapeople.org/gitweb?p=skvidal/public\_git/scripts.git;a=tree;f=ansible/host-reboot](http://fedorapeople.org/gitweb?p=skvidal/public_git/scripts.git;a=tree;f=ansible/host-reboot)

-sv

---

<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:** [April 19, 2012, 9:06pm UTC](https://forum.ansible.com/t/ans-command/11427/2 "2012-04-19T21:06:52Z")

</div>

> runs uptime on all the boxes in the default inventory.
> 
> ans-command --host=“host1” --host=“@groupspec” “uname -a”

yay new inventory API. Much nicer.

quick question so I can understand – Is this command script any different in behavior from:

/usr/bin/ansible host1:groupspec -a “uname -a”

–Michael

---

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [April 19, 2012, 9:57pm UTC](https://forum.ansible.com/t/ans-command/11427/3 "2012-04-19T21:57:07Z")

</div>

in terms of ansible's functionality no.

In terms of my use yes - it is substantially easier for me to remember which args I need to place.

also for the operations I frequently need to zip out it is much shorter to type since I will often need to do something to ALL hosts.

I'll probably add the other options I added to func-command a while back like confirmation and --oneline output (really handy for grepping something for results)

-sv
