我正在设置一个MySQL服务器,并希望Ansible mysql-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
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
如何阻止Ansible将明文密码写入日志文件?