如何在备份= 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