Check an Ansible playbook's syntax
Build a paste-ready command, then review its compatibility and effects before running it.
ansible-playbook -i <inventory> playbook.yml --syntax-checkComplete required fields to copy the generated command.
read-onlyno known side effects Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementsansible-playbookansible-playbook must be installed and available on PATH.
Version supportansible-playbook Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsplaybook: playbook.ymlRepresentative successful output; values vary with the selected target and system state.
Known errorsansible-playbook: command not foundansible-playbook is missing or is not available on PATH.
Verifyansible-playbook -i {{inventory}} playbook.yml --syntax-checkThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01ansible-playbookCommandRuns the ansible-playbook stage of this one-liner.
02-iOptionConfigures ansible-playbook with the -i option.
03<inventory>ParameterA value supplied in the Fill parameters section.
04playbook.ymlArgumentPasses playbook.yml to ansible-playbook.
05--syntax-checkOptionConfigures ansible-playbook with the --syntax-check option.
Example input
ansible-playbook -i inventory.ini playbook.yml --syntax-check
Example output
playbook: playbook.yml
Illustrative output — exact values vary by system and data.
Official sources