## change the namespace ansible localhost \ -m lineinfile \ -a "dest=~/project/deploy/dev/kustomization.yaml \ regexp='^namespace:' \ line='namespace: dev' \ state=present \ backup=yes " \ --diff ## change the Ingress ansible localhost \ -m replace \ -a "dest=~/project/deploy/dev/kustomization.yaml \ regexp='tryit' \ replace='devvit' \ backup=yes " \ --diff ## remove auto-resources ansible localhost \ -m lineinfile \ -a "dest=~/project/deploy/dev/kustomization.yaml \ regexp='auto\-resources' \ state=absent \ backup=yes " \ --diff标签:##,ansible,dev,replace,Ansible,remove,diff,line,yes From: https://www.cnblogs.com/zhangzhihui/p/16825266.html