Ansible commands are the foundation of how to work with Ansible. How to run Ansible
ad-hoc commands. We cover the basic
ansible command syntax and options as well as a few common Ansible modules.
This is a good place to start to understand the basics of what Ansible can do prior to learning the playbooks language – ad-hoc commands can also be used to do quick things that you might not necessarily want to write a full playbook for. You can read the guide here https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html
ansible webservers -a “/sbin/reboot” -f 10
The command launches on the group of hosts that we have in the webservers, the shell command, which in our case is a restart in 10 seconds of the machine. If we want to start experimenting with different commands, file transfers, copying files, operations to root, saving files, downloading and modifying archives … all we have to do is see the documentation.
- Previous Post