From 1d5206f53e7cb5f12cb57d1fc5fe98ac4cdf6198 Mon Sep 17 00:00:00 2001 From: Saleh Batati <0xack13@gmail.com> Date: Wed, 9 Oct 2019 16:10:32 -0400 Subject: [PATCH] Pass a JSON file to the Lambda's payload (#63261) * Add an example of passing a JSON file to the Lambda's payload Events passed to Lambda are commonly in JSON format, the change provides an example of using JSON file as an alternative to the inline YAML payload in the other examples. --- lib/ansible/modules/cloud/amazon/execute_lambda.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/execute_lambda.py b/lib/ansible/modules/cloud/amazon/execute_lambda.py index ebe5bf69273..3d88c480870 100644 --- a/lib/ansible/modules/cloud/amazon/execute_lambda.py +++ b/lib/ansible/modules/cloud/amazon/execute_lambda.py @@ -106,7 +106,13 @@ EXAMPLES = ''' wait: true tail_log: true register: response - # the response will have a `logs` key that will contain a log (up to 4KB) of the function execution in Lambda. + # the response will have a `logs` key that will contain a log (up to 4KB) of the function execution in Lambda + +# Pass the Lambda event payload as a json file. +- execute_lambda: + name: test-function + payload: "{{ lookup('file','lambda_event.json') }}" + register: response - execute_lambda: name: test-function