使用ansible命令尝试添加kubernetes docker注册表机密。下面的命令在命令行中工作,并给出以下错误消息。如何将特殊字符转义为命令?有没有更好的方法来执行此命令?
- name: Create regsecret
command: kubectl patch serviceaccount default -n {{ namespace }} -p "{\"imagePullSecrets\": [{\"name\": \"regsecret\"}]}"
错误消息:
- name: Create regsecret
command: kubectl patch serviceaccount default -n {{ namespace }} -p "{\"imagePullSecrets\"\: [{\"name\"\: \"regcred\"}]}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
谢谢