LoginSignup
1
1

More than 5 years have passed since last update.

Ansibleでユーザのパスワードを設定する

Posted at

Ansibleでユーザの作成時、パスワードを設定する際、ハッシュ化したものを登録する必要がある。

方法

まず対象のサーバの中で以下のスクリプトを実行する。
ハッシュによって得られる値は各サーバに依存するため、必ずユーザを作成するサーバで実行する。

python -c 'import crypt; print crypt.crypt("パスワード", "$1$mysalt$")'

得られた値を以下のように設定する。

- name: add trans user
  become: yes
  user: name=ユーザ名 password=得られた値 state=present

参考サイト

1
1
0

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
1
1