Ad-hoc run shell command
Run a one-liner shell command on all hosts
ansible all -i inventory -m shell -a 'uptime'
More ansible commands
-
ansible all -i inventory -m copy -a 'src=./file dest=/tmp/file'Copy a file to all hosts
-
ansible <host> -i inventory -m setup | jq '._ansible_facts'Collect all Ansible facts (OS, CPU, network) from a host
-
ansible-vault encrypt_string 'secret_value' --name 'db_password'Inline-encrypt a string for use in playbooks
-
ansible-vault encrypt vars/secrets.ymlEncrypt an entire variable file with Ansible Vault
-
ansible-vault decrypt vars/secrets.ymlDecrypt an Ansible Vault-encrypted file in place