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 }}"

On Friday, December 3, 2021 at 2:07:06 PM UTC+5:30 [email protected] wrote:

> That version is 3 years old now
> (
> 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
> 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?
>
>
>
> On Fri, 3 Dec 2021 at 07:51, Shivani Arora <[email protected]> wrote:
> >
> > -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)]
> >
> > On Friday, December 3, 2021 at 12:14:13 PM UTC+5:30 [email protected] 
> wrote:
> >>
> >> What is the output of 'ansible --version' ?
> >>
> >> On Fri, 3 Dec 2021 at 07:40, Shivani Arora <[email protected]> wrote:
> >>>
> >>> 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__:100: 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 
> \"<string>\", line 1, in <module>\n File 
> \"master:/usr/lib/python2.7/site-packages/ansible/modules/cloud/amazon/lambda_facts.py\",
>  
> line 401, in <module>\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
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> >>> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/2a820d5c-9f2d-4a3f-9b84-6515ca1978d2n%40googlegroups.com
> .
> >>
> >> --
> >> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/603c765b-db16-4f24-8b7b-fc2e63e6f4fcn%40googlegroups.com
> .
>
>
>
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/746ab50e-3d73-4901-bbb4-9b27819a5568n%40googlegroups.com.

Reply via email to