# Error while using lambda\_facts module

**URL:** <https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 3, 2021, 6:40am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061 "2021-12-03T06:40:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shivani\_Arora](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shivani\_Arora](https://forum.ansible.com/u/Shivani_Arora)\
**Post date:** [December 3, 2021, 6:40am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061/1 "2021-12-03T06:40:24Z")

</div>

Hi Team,

We are using lambda\_facts module of ansible to fetch existing aws lambda details but facing below issue while running -

TASK [Get lambda info if it already exists] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Thursday 02 December 2021 22:06:49 -0800 (0:00:00.339) 0:00:24.123 \*\*\*\*\*  
fatal: [localhost]: FAILED! =\> {“changed”: false, “module\_stderr”: “ **main** :95: RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\n\_\_main\_\_:96: RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\n\_\_main\_\_:97: RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\n\_\_main\_\_:98: RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\n\_\_main\_\_:99: RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\n\_\_main\_\_💯 RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\n\_\_main\_\_:104: RuntimeWarning: Parent module ‘ansible.modules’ not found while handling absolute import\nTraceback (most recent call last):\n File "master:/ws/shivania-sjc/qa/bender/ansible/playbooks/mitogen/ansible\_mitogen/runner.py", line 975, in \_run\n self.\_run\_code(code, mod)\n File "master:/ws/shivania-sjc/qa/bender/ansible/playbooks/mitogen/ansible\_mitogen/runner.py", line 941, in \_run\_code\n exec(‘exec code in vars(mod)’)\n File "", line 1, in \n File "master:/usr/lib/python2.7/site-packages/ansible/modules/cloud/amazon/lambda\_facts.py", line 401, in \n File "master:/usr/lib/python2.7/site-packages/ansible/modules/cloud/amazon/lambda\_facts.py", line 389, in main\nAttributeError: ‘module’ object has no attribute ‘config\_details’\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}

Please let me know how we can resolve this.

Regards,  
Shivani

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 3, 2021, 6:43am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061/2 "2021-12-03T06:43:49Z")

</div>

What is the output of ‘ansible --version’ ?

---

<div class="post-metadata">

**Author:** ![Shivani\_Arora](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shivani\_Arora](https://forum.ansible.com/u/Shivani_Arora)\
**Post date:** [December 3, 2021, 6:51am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061/3 "2021-12-03T06:51:01Z")

</div>

-bash-4.2$ ansible --version

ansible 2.7.5  
config file = /ws/shivania-sjc/qa/bender/ansible/playbooks/ansible.cfg  
configured module search path = [u’/ws/shivania-sjc/qa/bender/ansible/library’]  
ansible python module location = /usr/lib/python2.7/site-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 3, 2021, 8:36am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061/4 "2021-12-03T08:36:40Z")

</div>

That version is 3 years old now  
([https://github.com/ansible/ansible/blob/stable-2.7/changelogs/CHANGELOG-v2.7.rst#v2-7-5](https://github.com/ansible/ansible/blob/stable-2.7/changelogs/CHANGELOG-v2.7.rst#v2-7-5)),  
and has been EOL for a while:  
[https://docs.ansible.com/ansible/devel/reference\_appendices/release\_and\_maintenance.html#ansible-core-changelogs](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#ansible-core-changelogs)  
Given that the cloud modules have seen many improvements, I would  
start with a newer ansible version.

What does the playbook look like?  
And also, did your playbook work before and started failing? Or has it  
never worked?

---

<div class="post-metadata">

**Author:** ![Shivani\_Arora](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shivani\_Arora](https://forum.ansible.com/u/Shivani_Arora)\
**Post date:** [December 3, 2021, 10:58am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061/5 "2021-12-03T10:58:15Z")

</div>

And also, did your playbook work before and started failing? Or has it never worked? – Yes, the playbook was working before, now it’s giving error on task ( name: Get lambda info if it already exists)

- hosts: localhost

name: Create a CloudFront distribution for UI components bucket

roles:

- common

- aws

connection: local

gather\_facts: True

vars:

node\_runtime: “nodejs12.x”

cdn\_lambda\_name: “AddHeadersToCDNResponses-{{ ec2\_tag\_environment }}”

tasks:

# Get web vars so we can set the CDN URL correctly

- include\_vars: environment/{{ ec2\_tag\_environment }}/web\_vars.yml

- include\_vars: aws\_s3\_bucket\_names.yml

- set\_fact:

aws\_cloudfront\_cname: “cdn.{{ cloud\_web\_domain }}”

- debug: var=aws\_cloudfront\_cname

- name: Create IAM role for CloudFront lambda function

iam:

profile: “{{ aws\_profile\_name }}”

iam\_type: role

name: CloudFront-Lambda-{{ ec2\_tag\_environment }}

state: present

trust\_policy\_filepath: templates/aws-cloudfront-lambda-role.j2

register: lambda\_role\_facts

- debug: var=lambda\_role\_facts

- name: Create a zip archive of the AddHeadersToCDNResponses lambda function

archive:

path: aws\_lambda\_code/AddHeadersToCDNResponses/\*

dest: aws\_lambda\_code/AddHeadersToCDNResponses.zip

format: zip

- name: Get lambda info if it already exists

lambda\_facts:

query: config

function\_name: “{{ cdn\_lambda\_name }}”

profile: “{{ aws\_profile\_name }}”

region: “{{ aws\_region }}”

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 3, 2021, 11:12am UTC](https://forum.ansible.com/t/error-while-using-lambda-facts-module/36061/6 "2021-12-03T11:12:49Z")

</div>

Yes, the playbook was working before, now it's giving error on task (  
name: Get lambda info if it already exists)

Then something must have changed on your control node. But I don't know what.  
Since you are using a system managed ansible installation, that can be  
many things.
