Interview Prep/Ansible/Rapid-Fire Commands

How do you pass extra variables from a file or as JSON?

BeginnerProductionRapid-Fire Commands
Answer
ansible-playbook deploy.yml -e "app_version=2.4.1 env=staging"
ansible-playbook deploy.yml -e '{"app_ports": [8080, 8081]}'
ansible-playbook deploy.yml -e @vars/release-2.4.1.yml

Extra vars have the highest precedence. Key=value strings are always strings, so use JSON or a file for lists, booleans and numbers.

All Ansible questions Roadmap: Ansible

More on Rapid-Fire Commands