在剧本中进行更改时,Ansible处理程序不会触发

时间:2019-01-09 10:43:31

标签: ansible ansible-2.x

大家好,我有一连串的处理程序,只有在安装了应用程序的情况下,我才想解雇他们,但是他们似乎并没有解雇。

这是我的角色/任务/任务/main.yml

- name: Install Dynamic Retail
  win_package:
    path: 'C:\Soft\common\Dynamic Retail 2009\Dynamic Retail 2009 Setup.msi'
    arguments: /QUIET
    creates_path: C:\Program Files\Dynamic Retail 2009 for Microsoft Dynamics NAV Client\Dynavics.DynamicRetail.dll
    notify: Copy Dynamics DLL

这是我的角色/耕种/处理者/main.yml

---
- name: Copy Dynamics DLL
  win_copy:
    src: C:\Soft\common\Dynamic Retail 2009\Dynavics.DynamicRetail.dll
    dest: C:\Program Files\Dynamic Retail 2009 for Microsoft Dynamics NAV Client\Dynavics.DynamicRetail.dll
    remote_src: True
    notify: Copy Dynamics TLB

- name: Copy Dynamics TLB
  win_copy:
    src: C:\Soft\common\Dynamic Retail 2009\Dynavics.DynamicRetail.tlb
    dest: C:\Program Files\Dynamic Retail 2009 for Microsoft Dynamics NAV Client\Dynavics.DynamicRetail.tlb
    remote_src: True
    notify: Register Dynamic Retail DLLs

- name: Register Dynamic Retail DLLs
  win_command: C:\Soft\common\RegisterDR.bat

我确定我已经错过了一些基本的知识,但是我似乎无法弄清楚是什么?

1 个答案:

答案 0 :(得分:3)

我认为您有缩进问题:

- name: Install Dynamic Retail
  win_package:
    path: 'C:\Soft\common\Dynamic Retail 2009\Dynamic Retail 2009 Setup.msi'
    arguments: /QUIET
    creates_path: C:\Program Files\Dynamic Retail 2009 for Microsoft Dynamics NAV Client\Dynavics.DynamicRetail.dll
  notify: Copy Dynamics DLL

(“ notify”应与win_package内联,否则将被解释为win_package模块的参数,而不是运行win_package的任务)