Add support for espeak-ng. Closes #42438

pull/42598/head
Marcos Alano 6 years ago committed by Brian Coca
parent 824524c67a
commit 2d6bb2500e

@ -32,7 +32,7 @@ options:
description:
What voice to use
required: false
requirements: [ say or espeak ]
requirements: [ say or espeak or espeak-ng ]
author:
- "Ansible Core Team"
- "Michael DeHaan (@mpdehaan)"
@ -68,17 +68,18 @@ def main():
msg = module.params['msg']
voice = module.params['voice']
possibles = ('say', 'espeak', 'espeak-ng')
executable = module.get_bin_path('say')
if not executable:
executable = module.get_bin_path('espeak')
elif get_platform() != 'Darwin':
if get_platform() != 'Darwin':
# 'say' binary available, it might be GNUstep tool which doesn't support 'voice' parameter
voice = None
module.warn("'say' executable found but system is '%s': ignoring voice parameter" % get_platform())
if not executable:
module.fail_json(msg="Unable to find either 'say' or 'espeak' executable")
for possible in possibles:
executable = module.get_bin_path(possible)
if executable:
break
else:
module.fail_json(msg='Unable to find either %s' % ', '.join(possibles))
if module.check_mode:
module.exit_json(msg=msg, changed=False)

Loading…
Cancel
Save