ansible-playbook语法检查

ansible-playbook语法检查

列出主机

	[root@ops-test-01 nginx_v2]# ansible-playbook -i hosts --list-hosts web-tls.yml
	
	playbook: web-tls.yml
	
	  play #1 (Configure webserver with nginx and tls): host count=1
	
	    web_test01
	
	[root@ops-test-01 nginx_v2]#

语法检查

	[root@ops-test-01 nginx_v2]# ansible-playbook --syntax-check  web-tls.yml
	
	playbook: web-tls.yml
	
	[root@ops-test-01 nginx_v2]#

列出task

	[root@ops-test-01 nginx_v2]# ansible-playbook -i hosts --list-tasks web-tls.yml
	
	playbook: web-tls.yml
	
	  play #1 (Configure webserver with nginx and tls):	TAGS: []
	
	    Install Nginx server	TAGS: []
	
	    create directories for ssl certificates	TAGS: []
	
	    copy TLS key	TAGS: []
	
	    copy TLS certificate	TAGS: []
	
	    copy nginx config file	TAGS: []
	
	    copy index.html	TAGS: []
	
	[root@ops-test-01 nginx_v2]#	

检查语法是不是正确

	[root@ops-test-01 nginx_v2]# ansible-playbook --check web-tls.yml
	

See also