2016-11-28 13 views
-1

我已經在我的操作手冊中找到了這一點。調用角色的dir參數

roles: 
    - {role: cleanup-create, dir: '/standard/', commit: "{{choice}}"} 

文件結構是/roles/standard/cleanup-create/tasks/main.yml

然而,我收到此錯誤:

ERROR! the role 'cleanup-create' was not found in /home/myuser/network-ansible-myuser/roles:/home/myuser/network-ansible-myuser:/etc/ansible/roles 

The error appears to have been in '/home/myuser/network-ansible-myuser/configure-files.yml': line 15, column 5, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 

    roles: 
    - {role: cleanup-create, dir: '/standard', commit: "{{choice}}"} 
    ^here 

現在,錯誤消息似乎說我的角色沒有在/角色中找到。然而,dir參數應該使它看起來在/角色/標準下。

工作5分鐘前,我發誓!

回答

0

沒有dir角色的特殊參數。
這只是一個普通的變量,與你的例子中的commit相同。

您應該將所有角色直接放在./roles文件夾中,而不進行任何嵌套。

+0

我可以發誓,我做了它的工作。也許我看着錯誤的輸出。 – Quake

0

實際上,你可以設置roles_pathconfiguration variableansible.cfg(或者pass it in the command line - 試試吧,我不知道,如果你能做到這一點與roles_path)。

從DOC:

The roles path indicate additional directories beyond the roles/ subdirectory of a playbook project to search to find Ansible roles

從劇本目錄./roles將首先搜索,然後附加路徑將被檢查。

您可以指定多個目錄去尋找角色

roles_path=/var/opt/my_roles:/var/opt/more_roles