在 ansible 中,我想替换这个:
pgsql:
useCluster: false
addr: 127.0.0.1:5432
password: ""
email:
to: [email protected]
port: 465
password: ""
替换为:
pgsql:
useCluster: false
addr: 127.0.0.1:5432
password: "2024xxx"
email:
to: [email protected]
port: 465
password: ""
因为有两个相同的变量无法替换,所以我用了这个方法,但是无法实现,大家该如何处理呢?
replace:
path: "config.yaml"
regexp: '(redis:[^<]*)password: ""'
replace: '\1password: "2024xxx"'