Linux Command Library


run a command somewhere else

- List hosts belonging to a group:
ansible [group] --list-hosts

- Ping a group of hosts by invoking the ping module:
ansible [group] -m ping

- Display facts about a group of hosts by invoking the setup module:
ansible [group] -m setup

- Execute a command on a group of hosts by invoking command module with arguments:
ansible [group] -m command -a '[my command]'

- Execute a command with administrative privileges:
ansible [group] --become --ask-become-pass -m command -a '[my command]'

- Execute a command using a custom inventory file:
ansible [group] -i [inventory_file] -m command -a '[my command]'

ansible <host-pattern> [-f forks] [-m module_name] [-a args]

Ansible is an extra-simple tool/framework/API for doing 'remote things' over SSH.


A name of a group in the inventory file, a shell-like glob selecting hosts in inventory file, or any combination of the two separated by semicolons.

-v, --verbose

Verbose mode, more output from successful actions will be shown. Give up to three times for more output.
-i PATH, --inventory=PATH
The PATH to the inventory hosts file, which defaults to /etc/ansible/hosts.
-f NUM, --forks=NUM
Level of parallelism. NUM is specified as an integer, the default is 5.
Use this file to authenticate the connection.
-m NAME, --module-name=NAME
Execute the module called NAME.
The DIRECTORY to load modules from. The default is /usr/share/ansible.
The ARGUMENTS to pass to the module.
-k, --ask-pass
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
-K, --ask-sudo-pass
Prompt for the password to use with --sudo, if any
-o, --one-line
Try to output everything on one line.
-s, --sudo
Run the command as the user given by -u and sudo to root.
Save contents in this output DIRECTORY, with the results saved in a file named after each host.
Connection timeout to use when trying to talk to hosts, in SECONDS.
-B NUM, --background=NUM
Run commands in the background, killing the task after NUM seconds.
-P NUM, --poll=NUM
Poll a background job every NUM seconds. Requires -B.
-u USERNAME, --remote-user=USERNAME
Use this remote USERNAME instead of root.
Sudo to SUDO_USERNAME instead of root. Implies --sudo.
Connection type to use. Possible options are paramiko (SSH), ssh, and local. local is mostly useful for crontab or kickstarts.
-l SUBSET, --limit=SUBSET
Further limits the selected host/group patterns.
-l ~REGEX, --limit=~REGEX
Further limits hosts with a regex pattern.

Ansible stores the hosts it can potentially operate on in an inventory file. The syntax is one host per line. Groups headers are allowed and are included on their own line, enclosed in square brackets that start the line.

Ranges of hosts are also supported. For more information and additional options, see the documentation on

/etc/ansible/hosts - Default inventory file

/usr/share/ansible/ - Default module library

/etc/ansible/ansible.cfg - Config file, used if present

~/.ansible.cfg - User config file, overrides the default config if present

The following environment variables may specified.

ANSIBLE_HOSTS - Override the default ansible hosts file

ANSIBLE_LIBRARY - Override the default ansible module library path

ANSIBLE_CONFIG - Override the default ansible config file

Ansible was originally written by Michael DeHaan. See the AUTHORS file for a complete list of contributors.

Copyright © 2012, Michael DeHaan

Ansible is released under the terms of the GPLv3 License.

ansible-playbook(1), ansible-pull(1)

Extensive documentation as well as IRC and mailing list info is available on the ansible home page:

ansible-doc(1), ansible.add_host(3), ansible.apt(3), ansible.apt_key(3), ansible.apt_repository(3), ansible.assemble(3), ansible.async_status(3), ansible.authorized_key(3), ansible.command(3), ansible.copy(3), ansible.cron(3), ansible.debug(3), ansible.easy_install(3), ansible.ec2(3), ansible.ec2_facts(3), ansible.facter(3),, ansible.fetch(3), ansible.file(3), ansible.fireball(3), ansible.get_url(3), ansible.git(3),, ansible.group_by(3), ansible.hg(3), ansible.hpilo_boot(3), ansible.hpilo_facts(3), ansible.hponcfg(3), ansible.ini_file(3), ansible.lineinfile(3), ansible.mail(3), ansible.mount(3), ansible.mysql_db(3), ansible.mysql_user(3), ansible.nagios(3), ansible.network_facts(3), ansible.ohai(3), ansible.pacman(3), ansible.pause(3),, ansible.pip(3), ansible.pkgin(3), ansible.postgresql_db(3), ansible.postgresql_user(3), ansible.qemu_img(3), ansible.raw(3), ansible.script(3), ansible.seboolean(3), ansible.selinux(3), ansible.service(3), ansible.setup(3),, ansible.slurp(3), ansible.subversion(3), ansible.supervisorctl(3), ansible.svr4pkg(3), ansible.sysctl(3), ansible.template(3), ansible.user(3), ansible.vbox_facts(3), ansible.virt(3), ansible.virt_boot(3), ansible.virt_facts(3), ansible.vsphere_boot(3), ansible.vsphere_facts(3), ansible.wait_for(3), ansible.yum(3)

play store download app store download
Sonnenallee 29, 12047 Berlin, Germany

Privacy policy
Successfully copied