mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 15:41:22 -07:00
Reinstate --extra-vars, which can do things in playbooks like:
ansible-playbook release-my-app.yml --extra-vars="version=123" And make $version available in the playbook without re-editing the file
This commit is contained in:
parent
a0ac936a55
commit
b9982fc17b
6 changed files with 44 additions and 41 deletions
|
@ -35,6 +35,8 @@ def main(args):
|
|||
parser = utils.base_parser(constants=C, usage=usage, connect_opts=True, runas_opts=True)
|
||||
parser.add_option('-O', '--override-hosts', dest="override_hosts", default=None,
|
||||
help="run playbook against these hosts regardless of inventory settings")
|
||||
parser.add_option('-e', '--extra-vars', dest="extra_vars", default=None,
|
||||
help="set additional key=value variables from the CLI")
|
||||
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
|
@ -51,6 +53,7 @@ def main(args):
|
|||
override_hosts = None
|
||||
if options.override_hosts:
|
||||
override_hosts = options.override_hosts.split(",")
|
||||
extra_vars = utils.parse_kv(options.extra_vars)
|
||||
|
||||
# run all playbooks specified on the command line
|
||||
for playbook in args:
|
||||
|
@ -74,7 +77,8 @@ def main(args):
|
|||
timeout=options.timeout,
|
||||
transport=options.connection,
|
||||
sudo=options.sudo,
|
||||
sudo_pass=sudopass
|
||||
sudo_pass=sudopass,
|
||||
extra_vars=extra_vars
|
||||
)
|
||||
try:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue