I'm trying to install multiple Perl-Modules using ansible community.general.cpanm:
- name: Install perl packages
debug:
msg: "{{ item }}"
loop: "{{ imperia__cpan_packages }}"
- name: Install perl packages
cpanm:
name: "{{ item }}"
loop: "{{ imperia__cpan_packages }}"
First I thought I made a mistake in syntax but then I found out as soon as the module-name is more then a single word I'm getting this error:
TASK [myplaybook : Install perl packages] *****************************************
ok: [localimp] => (item=CPAN) => {
"msg": "CPAN"
}
ok: [localimp] => (item=DBI) => {
"msg": "DBI"
}
ok: [localimp] => (item=DBD::SQLite) => {
"msg": "DBD::SQLite"
}
ok: [localimp] => (item=JCRISTY/Image-Magick-6.9.12-1.tar.gz) => {
"msg": "JCRISTY/Image-Magick-6.9.12-1.tar.gz"
}
TASK [myplaybook : Install perl packages] *****************************************
ok: [localimp] => (item=CPAN) => {"ansible_loop_var": "item", "binary": null, "changed": false, "item": "CPAN", "name": "CPAN", "version": null}
ok: [localimp] => (item=DBI) => {"ansible_loop_var": "item", "binary": null, "changed": false, "item": "DBI", "name": "DBI", "version": null}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: 'NoneType' object is not iterable
failed: [localimp] (item=DBD::SQLite) => {"ansible_loop_var": "item", "binary": null, "changed": false, "item": "DBD::SQLite", "msg": "Module failed with exception: 'NoneType' object is not iterable", "name": "DBD::SQLite", "output": {"binary": null, "name": "DBD::SQLite", "version": null}, "vars": {"binary": null, "name": "DBD::SQLite", "version": null}, "version": null}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: 'NoneType' object is not iterable
failed: [localimp] (item=JCRISTY/Image-Magick-6.9.12-1.tar.gz) => {"ansible_loop_var": "item", "binary": null, "changed": false, "item": "JCRISTY/Image-Magick-6.9.12-1.tar.gz", "msg": "Module failed with exception: 'NoneType' object is not iterable", "name": "JCRISTY/Image-Magick-6.9.12-1.tar.gz", "output": {"binary": null, "name": "JCRISTY/Image-Magick-6.9.12-1.tar.gz", "version": null}, "vars": {"binary": null, "name": "JCRISTY/Image-Magick-6.9.12-1.tar.gz", "version": null}, "version": null}
PLAY RECAP *********************************************************************
My research so far wasn't quite successful because the Error Module failed with exception: 'NoneType' object is not iterable
can have way to many reasons...
It seems to happen for Perl modules that have more than one word in the name. I could not fix the issue, but here is my workaround: