Score:1

ansible - couldn't resolve module/action 'amazon.aws.s3_object' / The module amazon.aws.s3_object was not found in configured module paths

sa flag

Per requirements, I did installed all the required packages, however amazon.aws.s3_object is one of those things:

  • couldn't be resolved/found
  • was not found in configured module paths

step(s), I used to re-produce my issue:

% docker run -it debian:stable-slim bash
root@6140e6e2c06c:/# apt-get -qq update && apt-get -yqq install ansible python3-boto3 python3-botocore
root@6140e6e2c06c:/# uname -a
Linux 6140e6e2c06c 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux
root@6140e6e2c06c:/# cat /etc/debian_version
11.7
root@6140e6e2c06c:/# ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
root@6140e6e2c06c:/# python3 --version
Python 3.9.2
root@6140e6e2c06c:/#
root@6140e6e2c06c:/# ansible localhost -m amazon.aws.s3_object
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | FAILED! => {
    "msg": "The module amazon.aws.s3_object was not found in configured module paths"
}
root@6140e6e2c06c:/#...

Thank you in advance!

Score:1
in flag

Quote from the documentation:

This module is part of the amazon.aws collection (version 5.4.0).

...

To install it, use: ansible-galaxy collection install amazon.aws

root@befa2662325b:/# ansible-galaxy collection install amazon.aws
root@befa2662325b:/# ansible localhost -m amazon.aws.s3_object
localhost | FAILED! => {
    "changed": false,
    "msg": "missing required arguments: bucket, mode"
}

Alternatively, instead of working with the horribly outdated versions of Ansible and related packages, install Ansible via pip.

root@2b8f31d78667:/# apt install python3 python3-pip
root@2b8f31d78667:/# python3 -m pip install ansible
root@2b8f31d78667:/# ansible --version
ansible [core 2.14.6]
root@2b8f31d78667:/#
root@2b8f31d78667:/# ansible-galaxy collection list |grep aws
amazon.aws                    5.5.0
root@2b8f31d78667:/# ansible localhost -m amazon.aws.s3_object
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | FAILED! => {
    "changed": false,
    "msg": "missing required arguments: bucket, mode"
}
Score:0
br flag

Context:

  • Your installed version is Ansible 2.10.8
shell> root@6140e6e2c06c:/# ansible --version
ansible 2.10.8
...
  • The collection amazon.aws should be installed in Ansible 2.10.8 by default. See the build
amazon.aws: >=1.2.0,<2.0.0
  • The module s3_object was added in the collection amazon.aws version 1.0.0. See the source
DOCUMENTATION = r"""
---
module: s3_object
version_added: 1.0.0
short_description: Manage objects in S3
root@6140e6e2c06c:/# ansible --version
ansible 2.10.8
  config file = None

Solution:

Make sure the collection is included in the COLLECTIONS_PATHS. For example,

shell> ansible-config dump | grep COLLECTIONS_PATHS
COLLECTIONS_PATHS(/scratch/tmp7/test-353/ansible.cfg) = ['/home/admin/.local/lib/python3.9/site-packages']
shell> find /home/admin/.local/lib/python3.9/site-packages -name s3_object.py
/home/admin/.local/lib/python3.9/site-packages/ansible_collections/amazon/aws/plugins/action/s3_object.py
/home/admin/.local/lib/python3.9/site-packages/ansible_collections/amazon/aws/plugins/modules/s3_object.py

Change the path depending on where you installed the collections.


Note:

It is possible to install more versions of Ansible collections simultaneously. It's up to you to configure the path to the version you want to use.

in flag
the collection is indeed shipped with the Debian Ansible package, but this module is not included.
in flag
Maybe because the shipped version of the collection is version `1.4.0` ...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.