【问题标题】:Ansible 2.2 : Restart process using variable in handlers nameAnsible 2.2:使用处理程序名称中的变量重新启动进程
【发布时间】:2017-03-14 03:37:37
【问题描述】:

我想做这样的事情:

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

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

真正的结果是修改一个配置文件时所有进程都重启。

是否只重启所需的进程?

【问题讨论】:

    标签: ansible ansible-2.x


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-19
      • 1970-01-01
      • 2012-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多