错误!找不到角色 Users/xxxx/ansible/roles/basic_install'

问题描述 投票:0回答:0

我正在运行一个 ansible 剧本,但它找不到我定义的角色。我收到以下错误:

ERROR! the role 'Users/xxxx/ansible/roles/basic_install' was not found in /Users/xxxx/ansible/playbooks/roles:/Users/xxxx/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/Users/xxxx/ansible/playbooks

The error appears to be in '/Users/xxxx/ansible/playbooks/byrule.yml': line 6, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - role: 'Users/xxxx/ansible/roles/basic_install'
      ^ here

我有以下ansible结构:


ansible/
  ansible.cfg
  inventory
  playbooks/
    byrule.yml
  rules/
    basic_install/
      tasks/
        main.yml
    full_install/
      tasks/
        main.yml

使用的剧本内容:

---
- name: Basic install of packages on Debian
  hosts: all
  become: true
  roles:
    - basic_install

- name: Full install of packages on Debian
  hosts: all
  become: true
  roles:
    - full_install

最好的问候

根据错误输出,我尝试将规则作为 playbook 中的路径,或者将 rules 目录移动到 playbooks 目录中,但都没有用,我仍然得到同样的错误。如果有任何帮助,我将不胜感激。

ansible ansible-2.x ansible-inventory ansible-template
© www.soinside.com 2019 - 2024. All rights reserved.