45 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# ==========
 | 
						|
# running command: Troubleshooting, Tips, and Tricks
 | 
						|
# ==========
 | 
						|
 | 
						|
see also: https://ansible-tips-and-tricks.readthedocs.io/en/latest/ansible/commands/
 | 
						|
 | 
						|
 | 
						|
# ---
 | 
						|
# - Busted Cache
 | 
						|
# ---
 | 
						|
 | 
						|
# Sometimes Ansible has a tendency to hold on to variables too long, which causes 
 | 
						|
# Ansible to think that a task/operation had already been done or changed when in 
 | 
						|
# fact it didn't.
 | 
						|
# 
 | 
						|
# A simple fix is to flush the redis cache during a code execution.
 | 
						|
# 
 | 
						|
# This can be done like this:
 | 
						|
#
 | 
						|
ansible-playbook playbooks/PLAYBOOK_NAME.yml --flush-cache
 | 
						|
 | 
						|
 | 
						|
# ---
 | 
						|
# - Check for bad syntax
 | 
						|
# ---
 | 
						|
 | 
						|
# One can check to see if code contains any syntax errors by running the playbook.
 | 
						|
# 
 | 
						|
# Check for bad syntax:
 | 
						|
#
 | 
						|
ansible-playbook playbooks/PLAYBOOK_NAME.yml --syntax-check
 | 
						|
 | 
						|
 | 
						|
# ---
 | 
						|
# - Running a playbook in dry-run mode
 | 
						|
# ---
 | 
						|
 | 
						|
# Sometimes it can be useful to see what Ansible might do, but without actually 
 | 
						|
# changing anything.
 | 
						|
# 
 | 
						|
# One can run in dry-run mode like this:
 | 
						|
#
 | 
						|
ansible-playbook playbooks/PLAYBOOK_NAME.yml --check
 | 
						|
 |