Re: [ansible-project] How do you validate the Yaml file before Ansible it?

1,348 views
Skip to first unread message

Michael DeHaan

unread,
Feb 15, 2013, 2:54:47 PM2/15/13
to ansible...@googlegroups.com
ansible-playbook has a --check-syntax option.

In 1.1, it's a little smarter, and there is a --list-tasks to go along
with --list-hosts.



On Fri, Feb 15, 2013 at 2:51 PM, Steven Truong <djatl...@gmail.com> wrote:
> Hi all,
>
> I am looking for a way from the command line to validate the syntax of the
> Yaml files before using them with Ansible. Do you have any recommendation
> or best practices to share?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Brian Coca

unread,
Feb 15, 2013, 2:59:46 PM2/15/13
to ansible...@googlegroups.com
I pass it to stdin to the following script:

-- valyml.py
#!/usr/bin/env python
import yaml
import sys
print yaml.load(sys.stdin)

--
Brian Coca
Stultorum infinitus est numerus
0110000101110010011001010110111000100111011101000010000001111001011011110111010100100000011100110110110101100001011100100111010000100001
Pedo mellon a minno

Robert Blankenship

unread,
Mar 11, 2016, 10:01:02 PM3/11/16
to Ansible Project
I think that
ansible-playbook --syntax-check

is the correct command, not
ansible-playbook --check-syntax


Reply all
Reply to author
Forward
0 new messages