Template with to_ini in a loop: 'str' object has no attribute 'items'

The first problem is indentation. Everything below “mode: '0600'” needs to be shifted two columns to the left.

The second problem is that your simplified daks_backupninja_actions variable has no “section” level(s). The spurious message about the string having no items is because the underlying python module is trying to parse the value of the “bl” section as a dict, but its value is the string “environment”. Throw in another level between “config” and “bl”. (Ironically, your “but at the end something like this” data contains the “section” levels missing from the simplified data.)

1 Like