小编cla*_*aus的帖子

如何阻止 ansible 将密码写入日志文件?

我正在设置 MySQL 服务器并希望 Ansiblemysql-root在安装过程中设置密码。

在互联网的帮助下,我想出了这个解决方案:

- name: Set MySQL root password before installing
  debconf: name='mysql-server' question='mysql-server/root_password' value='{{mysql_root_pwd | quote}}' vtype='password'
- name: Confirm MySQL root password before installing
  debconf: name='mysql-server' question='mysql-server/root_password_again' value='{{mysql_root_pwd | quote}}' vtype='password'
- name: Install Mysql
  apt: pkg=mysql-server state=latest
Run Code Online (Sandbox Code Playgroud)

mysql_root_pwd是从 Ansible Vault 加载的变量。这运行良好,但现在服务器上的日志中有很多行:

Apr 10 14:39:59 servername ansible-debconf: Invoked with value=THEPASSWORD vtype=password question=mysql-server/root_password name=mysql-server unseen=None
Apr 10 14:39:59 servername ansible-debconf: Invoked with value=THEPASSWORD vtype=password question=mysql-server/root_password_again name=mysql-server unseen=None
Run Code Online (Sandbox Code Playgroud)

如何阻止 Ansible 将明文密码写入日志文件?

security ansible

30
推荐指数
3
解决办法
7万
查看次数

标签 统计

ansible ×1

security ×1