这是我的任务文件:
- name: installing epel-release
yum:
name: epel-release
state: installed
- name: installing required packages
yum:
name: "{{ item }}"
state: installed
with_items:
- nrpe
- nagios-plugins-all
- openssl
- name: pushing nrpe.cfg
template:
src: nrpe.cfg.j2
dest: /etc/nagios/nrpe.cfg
backup: yes
notify: restart nrpe
执行此剧本时,一切都运行良好。尽管处理程序正在执行,但当我检查客户端服务器时,nrpe 并未启动。
这是我的处理程序文件
- name: restart nrpe
service:
name: nrpe
state: restarted
enabled: yes
答案1
您需要将服务添加到您的剧本中,然后在那里启用并启动它。处理程序只是在文件更改时重新启动,我认为当文件未运行时它不会启动它...