Ansible 2.2:使用处理程序名称

时间:2017-03-13 17:00:30

标签: ansible ansible-2.x

我想做这样的事情:

 - copy: 
     src: file{{ item }}.xml
     dest: target_file{{ item }}.xml
   notify: restart process{{ item }}
   with_sequence: start=1 end={{ number_of_process }}

预期结果:仅当配置文件target_file1已被修改时才重启进程1,仅当配置文件target_file2已被修改等时才重启进程2。

实际结果是在修改一个配置文件时重启所有进程。

是否只想重新启动所需的流程?

1 个答案:

答案 0 :(得分:1)

好像是一个错误。我提交了问题#22579

如果您需要解决方法,请修改ansible/plugins/strategy/__init__.py

            for result_item in result_items:
                if '_ansible_notify' in result_item:
                    # if task_result.is_changed(): # comment this line
                    if result_item['changed']:     # add this