我正在尝试使用 Ansible 自动化一些任务。在我的剧本中,我有一个复制任务,然后我更改了文件的权限。完成此任务后,我需要重新启动服务。我包括通知并且还声明了我的处理程序,但奇怪的是这个处理程序永远不会被调用。
摘自我的剧本
- name: Configure Audit Log Purge Scheduler
copy:
src: "Scheduler-Log-Purge.config"
dest: "{{ crx_dir }}install/com.adobe.cq.audit.purge.Scheduler-LogPurge.config"
become: true
tags: aem
- name: Change Permissions of the Log Purge Scheduler config File
file:
path: "{{ crx_dir }}install/com.adobe.cq.audit.purge.Scheduler-LogPurge.config"
owner: crx
group: crx
become: true
notify: restart aem
tags: aem
- name: Pause the execution for cq5 to come up
pause:
minutes: 5
tags: aem
这是我的处理程序文件内容。
---
- name: restart aem
service: name=cq5 state=restarted
become: yes
运行 playbook 后的 o/p
gparasha-macOS:TLTD gparasha$ ansible-playbook -i hosts tltd.yml --tags aem -v
No config file found; using defaults
PLAY [Run tasks on Author] **************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************
ok: [35.169.196.183]
PLAY [Run AEM Specific Steps on Author] *************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************
ok: [35.169.196.183]
TASK [publish : Configure Audit Log Purge Scheduler] ************************************************************************************************************************************
ok: [35.169.196.183] => {"changed": false, "checksum": "3a9d00ea8357fd217a9442b1c408065abf077dfc", "failed": false, "gid": 1005, "group": "crx", "mode": "0644", "owner": "crx", "path": "/mnt/crx/author/crx-quickstart/install/com.adobe.cq.audit.purge.Scheduler-LogPurge.config", "secontext": "user_u:object_r:usr_t:s0", "size": 277, "state": "file", "uid": 1005}
TASK [publish : Change Permissions of the Log Purge Scheduler config File] **************************************************************************************************************
ok: [35.169.196.183] => {"changed": false, "failed": false, "gid": 1005, "group": "crx", "mode": "0644", "owner": "crx", "path": "/mnt/crx/author/crx-quickstart/install/com.adobe.cq.audit.purge.Scheduler-LogPurge.config", "secontext": "user_u:object_r:usr_t:s0", "size": 277, "state": "file", "uid": 1005}
TASK [publish : Pause the execution for cq5 to come up] *********************************************************************************************************************************
Pausing for 300 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
Press 'C' to continue the play or 'A' to abort
fatal: [35.169.196.183]: FAILED! => {"failed": true, "msg": "user requested abort!"}
但是当我运行这个剧本时,不会调用这个服务的重启。为什么会这样?
我们不能在文件模块中使用通知吗?任何帮助将不胜感激。