How do you run a playbook against the local machine only?
IntermediateProductionRapid-Fire Commands
Answer
ansible-playbook -i localhost, -c local site.yml
ansible-playbook -i localhost, -c local -e "ansible_python_interpreter={{ ansible_playbook_python }}" site.yml
The trailing comma makes localhost, an inline inventory list. Setting the interpreter to ansible_playbook_python makes modules use the same virtualenv as Ansible, which avoids "No module named boto3" style errors for cloud modules.
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