mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Merge branch 'master' into localconnection
Merge the SortedOptParser bits and debug attribute commits into localconnection. Conflicts: bin/ansible lib/ansible/playbook.py lib/ansible/runner.py lib/ansible/utils.py
This commit is contained in:
24
bin/ansible
24
bin/ansible
@@ -47,24 +47,12 @@ class Cli(object):
|
||||
def parse(self):
|
||||
''' create an options parser for bin/ansible '''
|
||||
|
||||
|
||||
options = {
|
||||
'-a' : dict(long='--args', dest='module_args',
|
||||
help="module arguments", default=C.DEFAULT_MODULE_ARGS),
|
||||
'-m' : dict(long='--module-name', dest='module_name',
|
||||
help="module name to execute", default=C.DEFAULT_MODULE_NAME)
|
||||
}
|
||||
|
||||
parser = utils.make_parser(
|
||||
options,
|
||||
usage='ansible <host-pattern> [options]',
|
||||
runas_opts=True,
|
||||
async_opts=True,
|
||||
output_opts=True,
|
||||
connect_opts=True,
|
||||
|
||||
)
|
||||
|
||||
parser = utils.base_parser(constants=C, runas_opts=True, async_opts=True,
|
||||
output_opts=True, connect_opts=True, usage='%prog <host-pattern> [options]')
|
||||
parser.add_option('-a', '--args', dest='module_args',
|
||||
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
|
||||
parser.add_option('-m', '--module-name', dest='module_name',
|
||||
help="module name to execute", default=C.DEFAULT_MODULE_NAME)
|
||||
|
||||
options, args = parser.parse_args()
|
||||
self.callbacks.options = options
|
||||
|
||||
@@ -32,18 +32,19 @@ def main(args):
|
||||
''' run ansible-playbook operations '''
|
||||
|
||||
# create parser for CLI options
|
||||
usage = "ansible-playbook playbook.yml [options]"
|
||||
options = {
|
||||
'-e' : dict(long='--extra-vars', dest='extra_vars',
|
||||
help='pass in extra key=value variables from outside the playbook'),
|
||||
'-O' : dict(long='--override-hosts', dest="override_hosts", default=None,
|
||||
help="run playbook against only hosts, ignorning the inventory file")
|
||||
}
|
||||
parser = utils.make_parser(options, constants=C, usage=usage)
|
||||
usage = "%prog playbook.yml"
|
||||
parser = utils.base_parser(constants=C, usage=usage)
|
||||
parser.add_option('-e', '--extra-vars', dest='extra_vars',
|
||||
help='arguments to pass to the inventory script')
|
||||
parser.add_option('-O', '--override-hosts', dest="override_hosts", default=None,
|
||||
help="run playbook against these hosts regardless of inventory settings")
|
||||
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
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
|
||||
|
||||
sshpass = None
|
||||
|
||||
Reference in New Issue
Block a user