mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
pushed module_loader to task_queue_manager so all cli's can benefit from it
also normalized -M option across all cli fixes #12016
This commit is contained in:
@@ -220,7 +220,7 @@ class CLI(object):
|
||||
setattr(parser.values, option.dest, os.path.expanduser(value))
|
||||
|
||||
@staticmethod
|
||||
def base_parser(usage="", output_opts=False, runas_opts=False, meta_opts=False, runtask_opts=False, vault_opts=False,
|
||||
def base_parser(usage="", output_opts=False, runas_opts=False, meta_opts=False, runtask_opts=False, vault_opts=False, module_opts=False,
|
||||
async_opts=False, connect_opts=False, subset_opts=False, check_opts=False, inventory_opts=False, epilog=None, fork_opts=False):
|
||||
''' create an options parser for most ansible scripts '''
|
||||
|
||||
@@ -241,10 +241,11 @@ class CLI(object):
|
||||
parser.add_option('-l', '--limit', default=C.DEFAULT_SUBSET, dest='subset',
|
||||
help='further limit selected hosts to an additional pattern')
|
||||
|
||||
if runtask_opts:
|
||||
parser.add_option('-M', '--module-path', dest='module_path',
|
||||
help="specify path(s) to module library (default=%s)" % C.DEFAULT_MODULE_PATH, default=None,
|
||||
if module_opts:
|
||||
parser.add_option('-M', '--module-path', dest='module_path', default=None,
|
||||
help="specify path(s) to module library (default=%s)" % C.DEFAULT_MODULE_PATH,
|
||||
action="callback", callback=CLI.expand_tilde, type=str)
|
||||
if runtask_opts:
|
||||
parser.add_option('-e', '--extra-vars', dest="extra_vars", action="append",
|
||||
help="set additional variables as key=value or YAML/JSON", default=[])
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class AdHocCLI(CLI):
|
||||
runtask_opts=True,
|
||||
vault_opts=True,
|
||||
fork_opts=True,
|
||||
module_opts=True,
|
||||
)
|
||||
|
||||
# options unique to ansible ad-hoc
|
||||
@@ -87,7 +88,7 @@ class AdHocCLI(CLI):
|
||||
self.options.ask_pass = False
|
||||
|
||||
sshpass = None
|
||||
becomepass = None
|
||||
becomepass = None
|
||||
vault_pass = None
|
||||
|
||||
self.normalize_become_options()
|
||||
|
||||
@@ -46,10 +46,9 @@ class DocCLI(CLI):
|
||||
self.parser = CLI.base_parser(
|
||||
usage='usage: %prog [options] [module...]',
|
||||
epilog='Show Ansible module documentation',
|
||||
module_opts=True,
|
||||
)
|
||||
|
||||
self.parser.add_option("-M", "--module-path", action="store", dest="module_path", default=C.DEFAULT_MODULE_PATH,
|
||||
help="Ansible modules/ directory")
|
||||
self.parser.add_option("-l", "--list", action="store_true", default=False, dest='list_dir',
|
||||
help='List available modules')
|
||||
self.parser.add_option("-s", "--snippet", action="store_true", default=False, dest='show_snippet',
|
||||
|
||||
@@ -48,6 +48,7 @@ class PlaybookCLI(CLI):
|
||||
runtask_opts=True,
|
||||
vault_opts=True,
|
||||
fork_opts=True,
|
||||
module_opts=True,
|
||||
)
|
||||
|
||||
# ansible playbook specific opts
|
||||
|
||||
@@ -53,6 +53,7 @@ class PullCLI(CLI):
|
||||
runtask_opts=True,
|
||||
subset_opts=True,
|
||||
inventory_opts=True,
|
||||
module_opts=True,
|
||||
)
|
||||
|
||||
# options unique to pull
|
||||
|
||||
Reference in New Issue
Block a user