Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to modify passwords in batches with ansible-playbook

Shulou Source: shulou.com Published: 2022-06-03 04:49:25 10月02日 Update

How to use ansible-playbook to change passwords in batches? This article uses the example code to show, the code is concise and easy to understand, and can be used as a reference for interested friends. I hope it will be helpful to you.

Create a playbook script

Vim change_passwd.yml

-hosts: a Note: ip group configuration in hosts file sudo: yes remote_user: root Note: remote user gather_facts: false tasks:-name: change user passwd user: name= {{item.user}} password= {{item.password | password_hash ('sha512')} update_password=always with_items:-{user:' version' Password:'*'} remarks: modify all users and passwords of the remote server *-{user: 'root', password:' *'} remarks: multiple users continue to add

Execute command: ansible-playbook change_passwd.ym

On the use of ansible-playbook batch password modification method to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you like this article, you might as well share it for more people to see.

Tags: Remarks passwords users code more articles help concise concise interests content commands multiple examples guys partners files methods servers knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker Xiaomi MySQL Apple