【发布时间】:2022-09-29 04:06:12
【问题描述】:
我尝试在 ansible 上创建带有循环的本地帐户。
密码在 group_vars 中
- name: \"Add users\"
user:
name: \"{{item.name}}\"
uid: \"{{item.uid}}\"
password: \"{{ item.name | string | password_hash(\'sha512\') }}\"
group: toto
update_password: always
comment: toto
shell: /bin/bash
password_expire_max: 365
loop:
- { uid: 12000, name: \'toto\', password: \"{{ toto | string | password_hash(\'sha512\') }}\" }
当我启动我的剧本时,密码在循环中以 SHA 打印
ok: [192.168.113.199] => (item={u\'password\': u\' password in sha \', u\'uid\': 12000, u\'name\': u\'toto\'})
有人知道如何隐藏密码吗? 提前谢谢
-
将此
no_log: true添加到任务中