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