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.
More on Rapid-Fire Commands
How do you see which hosts a playbook would run against, without running it?BeginnerHow do you list the tasks and tags a playbook contains?BeginnerHow do you inspect the inventory structure and a host's variables?BeginnerHow do you restart a service on a group with an ad-hoc command?BeginnerHow do you resume a playbook from a specific task or step through it?BeginnerHow do you re-run a playbook only on the hosts that failed?Intermediate