Invalid data passed to 'loop', it requires a list
Closed this issue · 6 comments
Hi there,
We've been using your excellent backup role for all of our production servers and it works great!
In my latest project using these versions:
- Ansible 2.13.3 (system 2.10.17)
- Trellis 1.16.0
- backup 2.1.7
- lafranceinsoumise.backup 5.5.0
I am suddenly getting an ansible error while re-provisioning:
TASK [lafranceinsoumise.backup : Install backup profile dependencies] **********
System info:
Ansible 2.13.3; Darwin
Trellis 1.16.0: July 18th, 2022
---------------------------------------------------
Invalid data passed to 'loop', it requires a list, got this instead:
[{'name': 'example.com_uploads', 'schedule': '0 4 * * *', 'source':
'/srv/www/example.com/shared/uploads', 'target':
's3://ams3.digitaloceanspaces.com/backups/example.com//uploads',
'target_user': False, 'target_pass': False, 'max_age': '3M', 'full_max_age':
'1M', 'max_full_backups': '3', 'params': ['export S3_USE_SIGV4="True"'],
'action': 'purge_backup --force'}] + [{'name': 'example.com_database',
'schedule': '0 4 * * *', 'source': 'mysql://example.com_production', 'target':
's3://ams3.digitaloceanspaces.com/backups/example.com//database',
'target_user': False, 'target_pass': False, 'max_age': '3M', 'full_max_age':
'1M', 'max_full_backups': '3', 'params': ['export S3_USE_SIGV4="True"'],
'action': 'purge_backup --force'}]. Hint: If you passed a list/dict of just
one element, try adding wantlist=True to your lookup invocation or use
q/query instead of lookup.
fatal: [159.223.217.50]: FAILED! => {}
I'm using the exact same variables as in my other projects which provisioned without any errors?
In my wordpress_sites.yml
:
backup:
enabled: true
auto: true
target: s3://ams3.digitaloceanspaces.com/backups/example.com/
schedule: '0 4 * * *'
purge: true
max_age: 3M
full_max_age: 1M
max_full_backups: 3
params:
- 'export S3_USE_SIGV4="True"'
In my vault.yml
:
backup_env:
AWS_ACCESS_KEY_ID: XXXXXXXX
AWS_SECRET_ACCESS_KEY: XXXXXXXX
I can see the {{ backup_profiles }}
variable being constructed here as:
[{...}] + [{...}]
But the error states this is not a valid ansible list syntax?
I'm guessing this has to do with my project's ansible version since the other projects run fine?
Anyone else bumped into this?
Thanks!
Did you try older versions of Ansible? This looks like a syntax error with newer versions.
We’ve been running this role with 2.9. Could try 2.9?
Hi @rutger1140, thanks for your reply!
The weird thing is, Trellis has had a minimum Ansible version of 2.10 since december 2021 and I have setup loads of new trellis projects after that with your role without any problems?
When I change the ansible version in requirements.txt
to:
ansible>=2.10.0,<2.12
And run
trellis exec ansible --version
It will use ansible 2.10.17
and re-provisioning runs fine!
So it must be a change in 2.11 or 2.12.
Is there any update on this? How did you fix it?
Is there any update on this? How did you fix it?
Put this in requirements.txt:
ansible>=2.10.0,<2.12
And run:
rm -rf .trellis && trellis init
Ran into the same error using ansible core 2.15.1
and adjusting the requirements does the trick – thanks!
But I would still like to know how to get this to work with the newer Ansible versions by adjusting the syntax 😉 If anyone manages to do so please post the solution here 🙏
@E-VANCE the role has multiple external dependencies that need to be upgraded as well. This trellis role is actually pretty minimal.
It would be nice to have a more recent version of Ansible supported. Feel free to issue a pull request and check Ansible version support of the other roles.