33
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ansibleでuser作ったときのパスワードではまる

Last updated at Posted at 2014-03-04

Ansibleのuserモジュールではユーザーを作成し、パスワードを設定することができる。このときパスワードにはハッシュを入力しないといけないそうな。
もちろん平文入れてました。

userモジュールのパスワード設定方法:

お好みのパスワードをハッシュ化してからplaybookへどうぞ。

パスワードをハッシュ化

python -c 'import crypt; print crypt.crypt("gitgit", "$1$SomeSalt$")'
$ $1$SomeSalt$WVHO24A0LENyKJQ9e7aI3/

playbookに書く

user/tasks/main.yml
---
- name: create git user.
  user: name=git
        password=$1$SomeSalt$WVHO24A0LENyKJQ9e7aI3/
        groups="wheel"

参考

33
33
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
33
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?