我正在编写一个剧本,我需要在其中执行 mysql 查询并以 json 格式传递输出。剧本代码工作正常,只是我想在字符串concatenate
部分遇到错误。如果我传递示例 json 字符串,它工作正常。
- name: Execute php script with json parameter
command: php -f /path/to/php/test.php "{'colors':{'red','blue','yellow'}}"
register: php_output
output.stdout_lines
是我的剧本中已经设置的变量,其中包含{'red','blue','yellow'}
格式的输出。
- name: Execute php script with json parameter
command: php -f /path/to/php/test.php '{"stdout_lines": {{output.stdout_lines}} }'
register: php_output
那么如何连接output.stdout_lines
变量'{"stdout_lines": {{output.stdout_lines}} }'
呢?有什么建议么