Hello What is the mistake I am making here. I am practicing roles from the lab, . . .

Joel:
Hello
What is the mistake I am making here. I am practicing roles from the lab, the error says it is unable to find
ansible-role-firewalld , however roles exists and also moved the tasks and edited deploy_firewalld.yml to use the roles, but still it fails

[thor@ansible-controller firewalld]$ cd roles/
[thor@ansible-controller roles]$ ls -ltr
total 4
drwxrwxr-x 10 thor thor 4096 Dec 30 08:26 ansible_role-firewalld
[thor@ansible-controller roles]$ cd ansible_role-firewalld/
[thor@ansible-controller ansible_role-firewalld]$ ls -ltr
total 36
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 templates
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 files
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 defaults
-rw-rw-r-- 1 thor thor 1328 Dec 30 08:26 README.md
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 vars
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 handlers
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 tests
drwxrwxr-x 2 thor thor 4096 Dec 30 08:26 meta
drwxrwxr-x 2 thor thor 4096 Dec 30 08:42 tasks
[thor@ansible-controller ansible_role-firewalld]$ cd tasks/
[thor@ansible-controller tasks]$ ls -ltr
total 4
-rw-rw-r-- 1 thor thor 227 Dec 30 08:42 main.yml
[thor@ansible-controller tasks]$ vi main.yml 
[thor@ansible-controller tasks]$ pwd          
/home/thor/playbooks/firewalld/roles/ansible_role-firewalld/tasks
[thor@ansible-controller tasks]$ cat main.yml 
---
- name: Install common dependencies
  yum:
    name:
      - firewalld
    state: installed
- name: Start firewalld
  service: name=firewalld state=started enabled=yes
[thor@ansible-controller tasks]$ cd ../../../
[thor@ansible-controller firewalld]$ 
[thor@ansible-controller firewalld]$ cat deploy_firewalld.yml 
- name: Configure Firewalld
  hosts: all
  roles:
    - ansible-role-firewalld
[thor@ansible-controller firewalld]$ ansible-playbook deploy_firewalld.yml -i inventory 
ERROR! the role 'ansible-role-firewalld' was not found in /home/thor/playbooks/firewalld/roles:/home/thor/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/thor/playbooks/firewalld

The error appears to have been in '/home/thor/playbooks/firewalld/deploy_firewalld.yml': line 4, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - ansible-role-firewalld
      ^ here

[thor@ansible-controller firewalld]$ 

Joel:
It fails here

Mohamed Ayman:
Hello @Joel
I’ve tried and it’s working fine as you see in the attached screenshot, please reset the lab and try again, the content of the deploy_firewalld.yml file is the below

- name: Configure Firewalld
  hosts: all
  roles:
    - ansible-role-firewalld

And the main.yaml file should be the below.


---
- name: Install common dependencies
  yum:
    name:
      - firewalld
    state: installed
- name: Start firewalld
  service: name=firewalld state=started enabled=yes

Joel:
Thanks @Mohamed Ayman, will retry as said

Max Leon:
you are calling ansible-role-firewalld but you have the folder for the role named ansible_role-firewalld

Joel:
Thanks @Max Leon