

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,477 Views
Hello all,
Got a question regarding the following 3 ad-hoc syntax:
1) ansible hostname -m command -a uptime
2) ansible hostname -m shell -a uptime
3) ansible hostname -a uptime
Okay, I get the same outupt - same results from running either command. My question
is, other than saving some keystrokes with the 3rd format, is there any other benefit to
using this (3rd item) syntax vs. the first two?
Thanks all.
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,461 Views
Hello, @Trevor
There is no difference between ansible hostname -m command -a uptime and ansible hostname -a uptime. The command module is used by default for the -m option. But the big difference between them both and ansible hostname -m shell -a uptime The shell is not used to execute the command for the command module, but the shell is run for the shell module. Compare: ansible hostname -a set and ansible hostname -m shell -a set


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,462 Views
Hello, @Trevor
There is no difference between ansible hostname -m command -a uptime and ansible hostname -a uptime. The command module is used by default for the -m option. But the big difference between them both and ansible hostname -m shell -a uptime The shell is not used to execute the command for the command module, but the shell is run for the shell module. Compare: ansible hostname -a set and ansible hostname -m shell -a set


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,284 Views
Hello Alexandre
Thank you for the very nice explanation.
Hope you're safe and well.