Ansible ERROR! Unexpected Exception: 'NoneType' object is not iterable

Ansible, ansible-playbook, playbook.yml:

ansible-playbook -i /env/dev testRole.yml
ERROR! Unexpected Exception: 'NoneType' object is not iterable

Solution:

Look like you are testing the role where no task define in tasks/main.yml file:


.
├── defaults
│   └── main.yml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   └── main.yml
├── tests
│   ├── inventory
│   └── test.yml
└── vars
    └── main.yml

Was tasks/main.yml

---
# tasks file for

Add the any Ansible module then it will resolved this issue. e.g.
Now your
tasks/main.yml

---
- name: Install zip/unzip util
  yum: name={{ item }} state=present
  with_items:
    - "zip"
    - "unzip"

Save and run it!!!

ansible-playbook -i /env/dev testRole.yml

PLAY [localhost] *********************************************

TASK [zip : Install zip/unzip util] *********************************
ok: [localhost] => (item=[u'zip', u'unzip'])

TASK [hybrisProvisionInstance : Install zip/unzip util] *****************
ok: [localhost] => (item=[u'zip', u'unzip'])

PLAY RECAP ************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0

Happy learning and implementation!!!

1 comment:

  1. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website "Devops Training in Bangalore"

    ReplyDelete

Please provide your input, it will honer for me...