Ansible - Ad-hoc command

Card Puncher Data Processing

Ansible - Ad-hoc command

About

Adhoc command 1) are command executed as in the shell via ansible.

You can therefore execute command on a whole cluster of server.

This is because the default module of the ansible command line is command

Example

[dev]
ansibleHostName1  ansible_host=hostname1  ansible_ssh_private_key_file=./privateKey.pem ansible_user=user
ansibleHostName2  ansible_host=hostname2  ansible_ssh_private_key_file=./privateKey.pem ansible_user=user
  • Example:
ansible -i ansible/hosts-remote.ini --playbook-dir=ansible -a "echo nico" dev 
ansibleHostName1 | CHANGED | rc=0 >>
nico

ansibleHostName2 | CHANGED | rc=0 >>
nico





Discover More
Card Puncher Data Processing
Ansible - Ansible command line

Ansible define and run a single playbook task against a set of hosts. Ansible “raw” module is a command line for executing commands in a quick and dirty way. The script module don’t even need...
Card Puncher Data Processing
Ansible - Command

command is the default module of the ansible command line and helps you execute adhoc (on the fly) command. shell module



Share this page:
Follow us:
Task Runner