You lost me when you when the author failed to properly understand how to use {{ item }} by defining with_items:
https://www.educba.com/ansible-with_items/
Let me fix his code here: https://pastebin.com/PQDAnHiJ
I use with_items at least once a day in this manner.