Ansible ad hoc commands
In order to issue direct command on server via ansible:
ansible [pattern] -m [module] -a "[module options]"
ansible webservers -e "ansible_user=root" -m shell -a "/etc/init.d/nginx restart"
as sudo
In order to issue direct command on server via ansible:
ansible [pattern] -m [module] -a "[module options]"
ansible webservers -e "ansible_user=root" -m shell -a "/etc/init.d/nginx restart"
as sudo
ansible-playbook --limit '!hoost1:!host2' yourPlaybook.yml
Show gathered information about hostansible hostname -m setup
use with stdout redirection to fileansible hostname -m setup > host_data.txt