Let’s say I have the following task:
- name: mongodb | Setup mongodb admin user
tags: mongodb
command: /usr/bin/mongo -u admin --eval “db.getSiblingDB(‘admin’).addUser(‘admin’, ‘{{pass_admin}}’)” admin
changed_when: false
ignore_errors: yes
All is fine with this, except one thing - my precious top-secret password gets written in /var/log/syslog by ansible-command, where it becomes visible to non-privileged users.
Is there any way to selectively prevent a task from logging this? I found the no_log parameter which specific modules can use to prevent some arguments from being logged, but it doesn’t seem usable by an end user.
Thanks!
P.S. The reason I’m not using the mongodb_user module is that it doesn’t work on Mongo 2.2. or lower, and I’m stuck with 2.0 for the moment. The syntax for addUser() is different in 2.4, and mongodb_user only supports that.