Scenario:
Changing logrotation to daily in all logrotate-config files.
- /etc/logrotate.d/*
- /etc/logrotate.conf
Tasks:
- Getting list of files in /etc/logrotate.d
- find:
paths: /etc/logrotate.d/
register: logrotate_d
- Changing log rotation in config files
- replace:
path: "{{ item.path }}"
regexp: '^(\s*)(daily|weekly|monthly|yearly)$'
replace: "\\1daily"
with_items:
- { path: "/etc/logrotate.conf" }
- "{{ logrotate_d.files }}"
loop_control:
label: "{{ item.path }}"
Question:
How can I replace with_items by loop without running in to the following error:
'list object' has no attribute 'path'