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

时间:2017-07-27 12:55:53

标签: amazon-s3 ansible

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

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

我收到以下错误:

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

其他有用信息:

  • 目标目录存在
  • 运行playbook的用户拥有目标目录的权限
  • 该文件存在于S3存储桶

1 个答案:

答案 0 :(得分:4)

查看docs

  使用GET操作下载对象/密钥时,

dest目标文件路径

尝试使用文件路径调用模块,而不是目录。 E.g:

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

或其他什么。