在lineinfile模块中使用backup = yes时,更改ansible playbook中备份文件的路径

时间:2016-07-12 10:46:02

标签: ansible ansible-playbook ansible-2.x

如何在备份= yes的ansible playbook中使用lineinfile模块时更改备份文件的路径。问题是备份文件存储在同一目录中,导致nginx服务每次都失败使用处理程序重新启动

- name: Down1
  lineinfile: backup=yes
              state=present
              dest=/etc/nginx/conf.d/new.conf
              regexp='^  server {{ groups['target'][1] }}:8080;'
              line='  server {{ groups['target'][1] }}:8080 down;'
  when: (groups['target'][0] == inventory_hostname) and (status == "down1")
  notify: Restart nginx

1 个答案:

答案 0 :(得分:1)

恕我直言,目前无法更改Ansible中备份文件的文件夹。这个问题有open issue on github