Added usage info to bin/ansible-playbook, now shows options on bare command line. NOTE: bin/ansible outputs usage to stdout, bin/ansible-playbook to stderr. Should they be consistent?

pull/126/head
Brad Olson 13 years ago
parent 74b26da9ac
commit 5a4d4bc051

@ -32,7 +32,7 @@ def main(args):
''' run ansible-playbook operations ''' ''' run ansible-playbook operations '''
# create parser for CLI options # create parser for CLI options
usage = "%prog playbook.yml [options]" usage = "%prog <playbook-file1 [playbook-file2...]> [options]"
options = { options = {
'-e' : dict(long='--extra-vars', dest='extra_vars', '-e' : dict(long='--extra-vars', dest='extra_vars',
help='pass in extra key=value variables from outside the playbook'), help='pass in extra key=value variables from outside the playbook'),
@ -43,7 +43,9 @@ def main(args):
options, args = parser.parse_args(args) options, args = parser.parse_args(args)
if len(args) == 0: if len(args) == 0:
print >> sys.stderr, "playbook path is a required argument" parser.print_help(file=sys.stderr)
#QUESTION for M.D. This would match bin/ansible's behavior. Do we want them consistent?
#parser.print_help()
return 1 return 1
sshpass = None sshpass = None

Loading…
Cancel
Save