获取对象时,Ansible aws s3在目录校验和失败

时间:2023-01-20 16:44:35

when getting an object from an S3 bucket using the following Ansible command:

使用以下Ansible命令从S3存储桶获取对象时:

- name: "copy object from s3://{{ s3_bucket }}/{{ s3_object }} to {{ dest }}"
  s3:
    bucket: "{{ s3_bucket }}"
    object: "{{ s3_object }}"
    dest: "{{ dest }}"
    mode: get

I get the following error:

我收到以下错误:

fatal: [som_fake_host]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "aws_access_key": null,
            "aws_secret_key": null,
            "bucket": "some-fake-bucket",
            "dest": "/some-fake-dest/",
            "ec2_url": null,
            "encrypt": true,
            "expiry": "600",
            "headers": null,
            "ignore_nonexistent_bucket": false,
            "marker": null,
            "max_keys": "1000",
            "metadata": null,
            "mode": "get",
            "object": "some_fake_file",
            "overwrite": "always",
            "permission": [
                "private"
            ],
            "prefix": null,
            "profile": null,
            "region": null,
            "retries": 0,
            "rgw": false,
            "s3_url": null,
            "security_token": null,
            "src": null,
            "validate_certs": true,
            "version": null
        }
    },
    "msg": "attempted to take checksum of directory: /some-fake-dest/"
}

additional useful information:

其他有用信息:

  • The destination directory exists
  • 目标目录存在
  • The user that runs the playbook has permission on the destination directory
  • 运行playbook的用户对目标目录具有权限
  • The file exists in S3 bucket
  • 该文件存在于S3存储桶中

1 个解决方案

#1


1  

Looking at the docs:

看文档:

dest The destination file path when downloading an object/key with a GET operation.

dest使用GET操作下载对象/密钥时的目标文件路径。

Try to call module with file path, not directory. E.g.:

尝试使用文件路径调用模块,而不是目录。例如。:

dest: "{{ dest }}/{{ s3_object }}"

or something.

或者其他的东西。

#1


1  

Looking at the docs:

看文档:

dest The destination file path when downloading an object/key with a GET operation.

dest使用GET操作下载对象/密钥时的目标文件路径。

Try to call module with file path, not directory. E.g.:

尝试使用文件路径调用模块,而不是目录。例如。:

dest: "{{ dest }}/{{ s3_object }}"

or something.

或者其他的东西。