Ansible Test - Playbook-linux-update-userpassword


複数のサーバの環境構成をAnableで管理し、ファイル管理を最小時間+自動化+Human Error 0%に処理


linuxサーバグループのユーザーパスワードの変更


how to update user password by playbook


Target: linux-server Group

[Inventory]
[linux-server]
target1 ansible_host=172.22.3.1 ansible_ssh_pass=ansible ansible_user=ansible
target2 ansible_host=172.22.3.2 ansible_ssh_pass=ansible ansible_user=ansible
[inux-user-updatepasswd.yml]
sudoコマンドが必要なので、beke、best methodを使用します.
- name: update user password
  hosts: linux-server
  become: yes
  become_method: sudo
  tasks:
  - user:
      name: testuser
      update_password: always
      password: "{{ newpassword|password_hash('sha512') }}"
[command]
 ansible-playbook user-updatepasswd-linux.yml -i inventory --extra-vars newpassword=thisisnew

ターゲット2(終了Ec 2)エラー
アクティブなtarget 1でユーザーパスワードの変更を完了

target 1からUser:testuserにアクセスし、sudoコマンドにpasswordを入力すると、既存のパスワードが「Sorry、もう一度試してください」になります.メッセージが表示され、変更された「thisisnew」が入力された場合、「testuserはsudoersファイルにありません.Thisイベントがレポートされます.」アクセス権に関するチェック結果の表示