我在使用 php 建立 ssl 连接时遇到了一些奇怪的问题。我有网络和数据库服务器。我已经通过openssl生成了证书。它们完全一样。
所以我正在尝试使用 mysql 命令从网络服务器连接:
mysql -h 10.1.1.1 -uroot -p
Password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 71
Server version: 5.5.5-10.1.19-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input …Run Code Online (Sandbox Code Playgroud) 我对 YML 和 Ansible 还很陌生,但是我的任务是为我的工作做一些自动化。我有一个字符串变量,里面需要有双引号和单引号:
-d 'request=("folder":"Testing_it","attributes":{})'
Run Code Online (Sandbox Code Playgroud)
所以我很快写了一个简单的游戏来检查它是否有效:
- name: Assign variable
set_fact:
params: " -d 'request=(\"folder\":\"Testing_it\",\"attributes\":{})'"
- name: Show output
debug:
msg: "{{ params }}"
Run Code Online (Sandbox Code Playgroud)
我想在继续之前查看我的变量的外观,这是 Ansible 的输出:
ok: [localhost] => {
"msg": " -d 'request=(\"folder\":\"Testing_it\",\"attributes\":{})'"
}
Run Code Online (Sandbox Code Playgroud)
为什么反斜杠包含在该变量中?有人可以帮助我如何正确编码以使其按预期工作
非常感谢您的帮助