Ensuring a command only runs once

Sorry if this has been asked before… Is there a pattern to ensure a command gets run once and only once on a machine? For instance if I want to seed a database on the initial deploy but I would never want to run this command again. I have been doing the following:
shell: mycommand && touch somefile creates=somefile

It works but wasn’t sure if there was a better way.

Thanks,
Jon

Creates is the way to go here!

Cool, thanks!

hi I have this exact issue but dont understand the anwer “Creates is the way to go here!” could anyone explain in little more detail? thanks.

http://docs.ansible.com/shell_module.html

parameter required default choices comments

creates no
    a filename, when it already exists, this step will *not* be run.