Ansible - Ad-hoc command

> Infrastructure as code > Ansible

1 - About

Ad Hoc are command executed as in the shell.

3 - 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
Advertising