Playbook using efs_info module fails when run from AWX

,
- name: Find EFS filesystem
  delegate_to: localhost
  become: no
  efs_info:
    tags:
      Name: "{{ home_dir_mount_tag_name }}"
  register: efs_info_res

When run the task fails because the AWS profile is not found.

In AWX I have the credential for AWS with profile attached and that profile works as the inventory also uses this profile (but in AWX that step runs separately).

I have tried setting env variable to the .aws/conf file to see if that would help.

When run outside of AWX the playbook works correctly but the user must auth to AWS prior to running.

I think AWX generally runs playbooks in execution environments (EE). By doing delegate_to: localhost you’re running the module in the EE’s container. The info module likely won’t be able to work in there since it won’t be able to access the host’s filesystem.

You likely need to explicitly add the host where AWX runs on to the inventory.

It worked when doing so when running it as an ansible playbook locally …

I removed delegate_to: localhost and it fails saying region is not set, but its set both as a variable and in the profile.