0

Ansible version: 2.6.3

My folder structure :

chrony/
├── handlers
│   └── main.yml
├── tasks
│   ├── config.yml
│   ├── main.yml
│   └── package.yml
└── templates
    └── chrony.conf.j2

The handlers main.yml was restarting chrony:

- name: Restart chrony service 
  service:
    name: chrony
    state: restarted

The config.yml was:

- name: Copy chrony.conf to /etc/chrony/
  template:
    src: chrony.conf.j2
    dest: /etc/chrony/chrony.conf

The main.yml was:

- name: Install chrony
  include: package.yml

- name: Configure chrony
  include: config.yml
  nodify:
    - Restart chrony service

The task "Copy chrony.conf to /etc/chrony/" was changed.

But handler was not executed.

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   
Nikola Kirincic
  • 3,651
  • 1
  • 24
  • 28
dommgifer
  • 71
  • 1
  • 1
  • 7

0 Answers0