escaping - How to escape double and single quotes in YAML within the same string -


i need escape single , double quotes in ansible playbook in order set environment variable. none of works:

  - name: set environment variable     command: >       export extra_config=“'”{"client": {"subscriptions": ["dind-worker"], "cluster": "internal"}}“'”    - name: set environment variable     command: >       export extra_config=''{"client": {"subscriptions": ["dind-worker"], "cluster": "internal"}}''    - name: set environment variable     command: >       export extra_config=''{\"client\": {\"subscriptions\": [\"dind-worker\"], \"cluster\": \"internal\"}}'' 

looked @ this:

http://yaml.org/spec/current.html#id2532720

https://github.com/dotmaster/toyaml/issues/1

the error message is:

fatal: [ip.address]: failed! => {"changed": false, "cmd": "export 'extra_config={\"client\":' '{\"subscriptions\":' '[\"dind-worker\"],' '\"cluster\":' '\"internal\"}}'", "failed": true, "msg": "[errno 2] no such file or directory", "rc": 2} 

> starts block scalar, in not need escape @ (and there no escape sequences processed). assuming want single quotes around json-like value, do:

  - name: set environment variable     command: >       export extra_config='{"client": {"subscriptions": ["dind-worker"], "cluster": "internal"}}' 

edit: aware folded scalar default includes trailing newline character. if not want have this, use >- instead of >.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -