Ansible - 使用加密字符串作为变量
Ansible - Using an encrypted string as variable
我正在尝试使用加密密码作为 SVN 的凭据。
不幸的是我得到了一个错误。
我的任务:
- name: Export subversion directory to folder
vars:
svn_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
61366435663930323762326534376237329939319321939999373334616364343865333830333435
6338646239363735376431633863333632363135383963390a636664353535663366336263626264
39616366333132316531653461646365393332386365366264613931383165366235343238336463
3438336335613838380a393037613636396564326465396132613162326335313932626135666333
3630
subversion:
repo: svn://myserver/trunk
dest: /tmp/svn
username: svnuser
password: {{ svn_pass }}
become: true
我得到的错误:
The offending line appears to be:
username: ****
password: {{ svn_pass }}
^ 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
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
如错误消息所述,您忘记了引号
password: "{{ svn_pass }}"
我正在尝试使用加密密码作为 SVN 的凭据。
不幸的是我得到了一个错误。
我的任务:
- name: Export subversion directory to folder
vars:
svn_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
61366435663930323762326534376237329939319321939999373334616364343865333830333435
6338646239363735376431633863333632363135383963390a636664353535663366336263626264
39616366333132316531653461646365393332386365366264613931383165366235343238336463
3438336335613838380a393037613636396564326465396132613162326335313932626135666333
3630
subversion:
repo: svn://myserver/trunk
dest: /tmp/svn
username: svnuser
password: {{ svn_pass }}
become: true
我得到的错误:
The offending line appears to be:
username: **** password: {{ svn_pass }} ^ 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
start a value. For instance:
with_items: - {{ foo }}
Should be written as:
with_items: - "{{ foo }}"
如错误消息所述,您忘记了引号
password: "{{ svn_pass }}"