Ansible版本:2.6.3
我的文件夹结构:
chrony/
├── handlers
│ └── main.yml
├── tasks
│ ├── config.yml
│ ├── main.yml
│ └── package.yml
└── templates
└── chrony.conf.j2
处理程序main.yml正在重新启动chrony:
- name: Restart chrony service
service:
name: chrony
state: restarted
config.yml是:
- name: Copy chrony.conf to /etc/chrony/
template:
src: chrony.conf.j2
dest: /etc/chrony/chrony.conf
main.yml是:
- name: Install chrony
include: package.yml
- name: Configure chrony
include: config.yml
nodify:
- Restart chrony service
“将chrony.conf复制到/ etc / chrony /”任务已更改。
但是处理程序未执行。
TASK [chrony : Install chrony] ******************************************************************************************************************
ok: [controller1]
ok: [controller2]
ok: [controller3]
TASK [chrony : Copy chrony.conf to /etc/chrony/] ************************************************************************************************
changed: [controller1]
changed: [controller3]
changed: [controller2]
PLAY RECAP **************************************************************************************************************************************
controller1 : ok=3 changed=1 unreachable=0 failed=0
controller2 : ok=3 changed=1 unreachable=0 failed=0
controller3 : ok=3 changed=1 unreachable=0 failed=0