1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

adding -K flag for ask-sudo-pass to ansible-pull

This commit is contained in:
Steve Tjoa 2014-02-03 12:20:04 -08:00
parent 2d0e9cd75d
commit 335bc1ee5c

View file

@ -123,6 +123,8 @@ def main(args):
default=DEFAULT_REPO_TYPE, default=DEFAULT_REPO_TYPE,
help='Module name used to check out repository. ' help='Module name used to check out repository. '
'Default is %s.' % DEFAULT_REPO_TYPE) 'Default is %s.' % DEFAULT_REPO_TYPE)
parser.add_option('-K', '--ask-sudo-pass', default=False, dest='ask_sudo_pass', action='store_true',
help='ask for sudo password')
options, args = parser.parse_args(args) options, args = parser.parse_args(args)
hostname = socket.getfqdn() hostname = socket.getfqdn()
@ -180,6 +182,8 @@ def main(args):
cmd = 'ansible-playbook %s %s' % (base_opts, playbook) cmd = 'ansible-playbook %s %s' % (base_opts, playbook)
if options.inventory: if options.inventory:
cmd += ' -i "%s"' % options.inventory cmd += ' -i "%s"' % options.inventory
if options.ask_sudo_pass:
cmd += ' -K'
os.chdir(options.dest) os.chdir(options.dest)
# RUN THE PLAYBOOK COMMAND # RUN THE PLAYBOOK COMMAND