diff --git a/lib/ansible/modules/monitoring/datadog_monitor.py b/lib/ansible/modules/monitoring/datadog_monitor.py index 3ae7c7b5b41..6de170f9434 100644 --- a/lib/ansible/modules/monitoring/datadog_monitor.py +++ b/lib/ansible/modules/monitoring/datadog_monitor.py @@ -221,7 +221,7 @@ def _get_monitor(module): else: monitors = api.Monitor.get_all() for monitor in monitors: - if monitor['name'] == module.params['name']: + if monitor['name'] == _fix_template_vars(module.params['name']): return monitor return {} @@ -229,7 +229,9 @@ def _get_monitor(module): def _post_monitor(module, options): try: kwargs = dict(type=module.params['type'], query=module.params['query'], - name=module.params['name'], message=_fix_template_vars(module.params['message']), + name=_fix_template_vars(module.params['name']), + message=_fix_template_vars(module.params['message']), + escalation_message=_fix_template_vars(module.params['escalation_message']), options=options) if module.params['tags'] is not None: kwargs['tags'] = module.params['tags'] @@ -251,7 +253,9 @@ def _equal_dicts(a, b, ignore_keys): def _update_monitor(module, monitor, options): try: kwargs = dict(id=monitor['id'], query=module.params['query'], - name=module.params['name'], message=_fix_template_vars(module.params['message']), + name=_fix_template_vars(module.params['name']), + message=_fix_template_vars(module.params['message']), + escalation_message=_fix_template_vars(module.params['escalation_message']), options=options) if module.params['tags'] is not None: kwargs['tags'] = module.params['tags']