I set group_vars for roles in the Playbook and kept saying no variables were defined. The PlayBook works fine on other computers. This is the directory structure.

[root @ devel ansible] # tree. ├ ─ ─ ansible. CFG ├ ─ ─ devel ├ ─ ─ group_vars │ ├ ─ ─ devel ├ ─ ─ hosts ├ ─ ─ host_vars │ └ ─ ─ 192.168.3.8 ├ ─ ─ playbooks │ └ ─ ─ dev. Yaml └ ─ ─ roles ├ ─ ─ common │ ├ ─ ─ defaults │ ├ ─ ─ files │ │ └ ─ ─ yum │ │ ├ ─ ─ seven │ │ │ ├ ─ ─ CentOS - Base. Repo │ │ │ ├ ─ ─ Docker - ce. Repo │ │ │ └ ─ ─ epel, repo │ │ └ ─ ─ eight │ │ └ ─ ─ CentOS - 8. Repo │ ├ ─ ─ handlers │ ├ ─ ─ meta │ ├ ─ ─ the tasks │ │ └ ─ ─ the main, yaml │ ├ ─ ─ templates │ └ ─ ─ varsCopy the code

Group_vars is as follows:

[root@devel ansible]# cat group_vars/devel
repo_dir: /etc/yum.repos.d
backup_repo_dir: /etc/yum.repos.d/backup
is_backup_repo: false
Copy the code

The content of roles is:

[root@devel ansible]# more roles/common/tasks/main.yaml
---
- name: Checking backup directory
  stat:
    path: "{{ item }}"
  register: folder_stats
  with_items:
    - "{{ backup_repo_dir }}"
    #- ["/etc/yum.repos.d/backup"]
  when:
    - (is_backup_repo)
Copy the code

The PlayBook is:

[root@devel ansible]# cat playbooks/dev.yaml
---
- name: "System init"
  hosts: devel
  roles:
    - common
Copy the code

I don’t know why it’s been unavailable. Please give advice or comments