mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Very basic --diff option for showing what happens when templates change.
Probably output is not useful if not used with --limit Works well with --check mode
This commit is contained in:
18
bin/ansible
18
bin/ansible
@@ -45,8 +45,18 @@ class Cli(object):
|
||||
def parse(self):
|
||||
''' create an options parser for bin/ansible '''
|
||||
|
||||
parser = utils.base_parser(constants=C, runas_opts=True, subset_opts=True, async_opts=True,
|
||||
output_opts=True, connect_opts=True, check_opts=True, usage='%prog <host-pattern> [options]')
|
||||
parser = utils.base_parser(
|
||||
constants=C,
|
||||
runas_opts=True,
|
||||
subset_opts=True,
|
||||
async_opts=True,
|
||||
output_opts=True,
|
||||
connect_opts=True,
|
||||
check_opts=True,
|
||||
diff_opts=False,
|
||||
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',
|
||||
@@ -54,6 +64,7 @@ class Cli(object):
|
||||
default=C.DEFAULT_MODULE_NAME)
|
||||
parser.add_option('--list-hosts', dest='listhosts', action='store_true',
|
||||
help="dump out a list of hosts matching input pattern, does not execute any modules!")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
self.callbacks.options = options
|
||||
|
||||
@@ -112,7 +123,8 @@ class Cli(object):
|
||||
callbacks=self.callbacks, sudo=options.sudo,
|
||||
sudo_pass=sudopass,sudo_user=options.sudo_user,
|
||||
transport=options.connection, subset=options.subset,
|
||||
check=options.check
|
||||
check=options.check,
|
||||
diff=options.check
|
||||
)
|
||||
|
||||
if options.seconds:
|
||||
|
||||
@@ -52,8 +52,15 @@ def main(args):
|
||||
|
||||
# create parser for CLI options
|
||||
usage = "%prog playbook.yml"
|
||||
parser = utils.base_parser(constants=C, usage=usage, connect_opts=True,
|
||||
runas_opts=True, subset_opts=True, check_opts=True)
|
||||
parser = utils.base_parser(
|
||||
constants=C,
|
||||
usage=usage,
|
||||
connect_opts=True,
|
||||
runas_opts=True,
|
||||
subset_opts=True,
|
||||
check_opts=True,
|
||||
diff_opts=True
|
||||
)
|
||||
parser.add_option('-e', '--extra-vars', dest="extra_vars", default=None,
|
||||
help="set additional key=value variables from the CLI")
|
||||
parser.add_option('-t', '--tags', dest='tags', default='all',
|
||||
@@ -122,7 +129,8 @@ def main(args):
|
||||
extra_vars=extra_vars,
|
||||
private_key_file=options.private_key_file,
|
||||
only_tags=only_tags,
|
||||
check=options.check
|
||||
check=options.check,
|
||||
diff=options.diff
|
||||
)
|
||||
|
||||
if options.listhosts:
|
||||
|
||||
Reference in New Issue
Block a user