ansibleでユーザー作成するときのパスワード作成
ドキュメントによると以下の通り、passwodはハッシュ化したものを指定しろとある
ansible all -m user -a "name=foo password=<crypted password here>"
ハッシュ化したパスワードの作り方はexamplesのuser_commads.ymlにコメントとして書いてある
https://github.com/ansible/ansible-examples/blob/e7832eb7daf1704879ddc6b2049bcabd27c4ec05/language_features/user_commands.yml
python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")'
なお、このワンライナーの実行結果は実行環境のシステムに依存するので、ログイン先のサーバーで実行した結果を使用しないとログインできない可能性がある。
mac osx
$ python Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. $ python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")' $15Dq6xVfTuV6
$ python Python 2.7.3 (default, Sep 26 2013, 20:03:06) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. $ python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")' $1$SomeSalt$UqddPX3r4kH3UL5jq5/ZI.