Ensure command-line tools (or xcode) are installed on OS X?

I was wondering what the best way to ensure that the apple command-line tools (or xcode) are installed on a OS X host. Does anyone know of a good way or of a pattern to ensure that this is the case with ansible?

I check the exit code of running “xcodebuild --help”. I don’t have an Ansible example to offer, but I hope this helps.

-Baraa