Ansible“包括”陈述和自动调整

我的可靠的'包括'声明工作正常,但最近在包括子文件夹中的ymls后,它以某种方式打破了angular色的path。

这是我的angular色树:

. ├── site.yml ├── inventory.ini └── roles └── webservers   ├── files   │  └── crt.crt   ├── tasks   │  ├── main.yml   │  ├── httpd.yml   │  ├── dev   │  │  ├── httpd.yml   │  │  └── main.yml   │  └── prod   │  ├── httpd.yml   │  └── main.yml   ├── templates   │  └── httpd_conf.j2   └── vars   └── main.yml 

site.yml:

  - name: Install base software sudo: yes vars: profile: "dev" roles: - webservers 

angular色/ Web服务器/任务/ main.yml:

  - name: Install httpd include: httpd.yml - name: Including specific tasks include: "{{ profile }}/main.yml" 

在此之前,它工作得很好。 但是下一步,在包含“profile”/main.yml之后,将会删除angular色的path。

angular色/ Web服务器/任务的/ dev / main.yml:

  - name: Create httpd.conf from template template: src=httpd_conf.j2 dest=/etc/httpd/conf/httpd.conf with_items: webservers_httpd_vhosts 

导致一个错误:

 TASK: [webservers | Create httpd.conf from template] ********************* fatal: [192.168.0.2] => input file not found at /home/me/git/repo/projects/ans/roles/webservers/tasks/templates/httpd_conf.j2 or /home/me/git/repo/projects/ans/httpd_conf.j2 FATAL: all hosts have already failed -- aborting 

因此,在“包含”之后,它以某种方式认为angular色的根位于“ webservers / tasks / ”而不是“ webservers / ”。 但在同一时间,它会看到“webservers / vars /”path中的variables。

此外,它工作正常,最近刚爆发。 我没有更新,也没有编辑它的参数,只是更新了剧本。

如果我指定'src = .. / .. / templates / httpd_conf.j2',它可以正常工作,但由于这种行为只是从无处不在,所以我不能依赖这个path。

那么,为什么会出现这个错误,以及如何防止angular色的根变化?

Ansilbe的版本:1.9.0.1