0

I am using ansible-playbook to apply life cycle management on S3 bucket. Below is the ansible task.

- name: Configure a lifecycle 
  community.aws.s3_lifecycle:
    name: "{{ bucketName }}"
    expiration_days: 30
    aws_access_key: "{{ accessKey }}"
    aws_secret_key: "{{ secretKey }}"
    ec2_url: "{{ endPoint }}"
    status: enabled
    state: present
    validate_certs: false

Ref Link: https://docs.ansible.com/ansible/latest/collections/community/aws/s3_lifecycle_module.html#parameter-rule_id

However I am getting below error msg while I am running ansible task. Do I miss anything here?

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: botocore.exceptions.ClientError: An error occurred (NoSuchBucketPolicy) when calling the GetBucketLifecycleConfiguration operation: The bucket policy does not exist.

fatal: [localhost]: FAILED! => {"boto3_version": "1.23.10", "botocore_version": "1.26.10", "changed": false, "error": {"code": "NoSuchBucketPolicy", "message": "The bucket policy does not exist.", "resource": "test191"}, "msg": "An error occurred (NoSuchBucketPolicy) when calling the GetBucketLifecycleConfiguration operation: The bucket policy does not exist.

Zeitounator
  • 38,476
  • 7
  • 53
  • 66
Rag
  • 13
  • 2
  • Before going any further, did you check your are using the latest possible versions of 1) ansible 2) community.aws collection 3) boto3 and botocore python libs? Did you also double check that your test191 bucket actually exist? – Zeitounator Oct 02 '22 at 11:49
  • Ansible version: 2.10.17 boto3 1.16.0 botocore 1.19.0 After i update ansible/boto3 version as above. I am getting below error msg now ============================================================= ImportError: cannot import name 'normalize_boto3_result' "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", @Zeitounator – Rag Oct 04 '22 at 08:54

0 Answers0