我有一个组织如下的剧本(为了这个问题而简化):
├── deploy.yml
├── hosts
├── requirements.yml
├── roles
│ └── web
│ ├── meta
│ │ └── main.yml
│ └── tasks
│ └── main.yml
└── site.retry
我的简化deploy.yml
是:
---
- name: Everything I need
hosts: somewhere
roles:
- web
我的简化roles/web/tasks/main.yml
是
---
- name: Various things that work
become: yes
[whatever]
- name: the thing that I have a problem with
become: yes
davidedelvento.nbextension: name=foo state=present
这失败了:
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
所以我尝试更改roles/web/tasks/main.yml
为
---
- name: Various things that work
become: yes
[whatever]
- name: the thing that I have a problem with
become: yes
roles:
- { role: davidedelvento.nbextension, name: foo, state: present}
以同样的方式失败。我理解失败(因为我不能从任务中调用角色,而是我正在这样做——但错误可能更清楚......)
但是我不清楚我怎样才能完成我想要的,即在那个时间点做任何 nbextension 正在做的事情。我可以将该角色从roles/web/tasks/main.yml
to移动到roles/web/meta/main.yml
并且可以工作,但它是在 the 之前执行的Various things that work
,我需要在之后执行它。如何做到这一点?
请注意,我写了nbextension,但是同样的问题发生在银河系中类似的其他角色上。
编辑:另请注意,扩展程序已正确安装,并且可以从独立的单文件剧本中使用,例如
---
- name: Example
hosts: all
become: yes
roles:
- { role: davidedelvento.nbextension, name: foo, state: present}
但是我需要它在上面描述的更大的项目中“集成”“网络”角色(我有更多我没有展示的角色)
EDIT2:请注意,用于此问题的 Galaxy ansible 角色已重命名为jupyterextension但正如我所说,任何角色的问题(和解决方案)都是相同的