From 2d6bb2500e23d4788e247755a7c78da866bbee99 Mon Sep 17 00:00:00 2001 From: Marcos Alano Date: Tue, 10 Jul 2018 15:00:25 -0300 Subject: [PATCH] Add support for espeak-ng. Closes #42438 --- lib/ansible/modules/notification/say.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/notification/say.py b/lib/ansible/modules/notification/say.py index 759803b08aa..c719176c215 100644 --- a/lib/ansible/modules/notification/say.py +++ b/lib/ansible/modules/notification/say.py @@ -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)