小编Mat*_*ton的帖子

使用ansible编辑多个目标文件?

我目前正在尝试更新多个服务器上的所有wp-config.php文件.下面这应该工作,但它不允许我使用正则表达式的目的地.

有没有人知道另一种方法呢?

---
- hosts: blah.blah.net
  user: blah
  sudo: true
  tasks:
  - name: add a new string before the match
    lineinfile: dest='\/home\/.*\/public_html\/wp-config.php'
                regexp='^\/\*\* MySQL database password \*\/'
                insertbefore='^\/\*\* MySQL database password \*\/'
                line='define("DISALLOW_FILE_MODS", true);'
Run Code Online (Sandbox Code Playgroud)

yaml ansible

2
推荐指数
1
解决办法
1700
查看次数

标签 统计

ansible ×1

yaml ×1