Hi all, I’m attempting to encrypt an s3 bucket and then encrypt all the contents in the bucket given a list of bucket. I’ve got the following
---
- name: "S3 bucket encryption"
hosts: localhost
connection: local
vars:
buckets:
- test
tasks:
- name: encrypt S3 bucket
s3_bucket:
name: "{{ item }}"
encryption: AES256
state: present
with_items: "{{ buckets }}"
ignore_errors: true
- name: obtain list of all objects in bucket
aws_s3:
bucket: "{{ item }}"
object: /
mode: list
with_items: "{{ buckets }}"
register: bucket_item_list
ignore_errors: true
- name: encrypt all objects in bucket
aws_s3:
bucket: "{{ item.item }}"
object: "{{ item.s3_keys }}"
src: "{{ item.s3_keys }}"
encrypt: yes
encryption_mode: AES256
mode: put
with_items: "{{ bucket_item_list.results }}"
ignore_errors: true
However, the last step results in the following error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: expected str, bytes or os.PathLike object, not list
fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}
Any ideas as to why its complaining about a list? I assume the with_items will loop through the list
🤔