ansible 示例

1.创建用户并修改密码

密码需要sha512机密

[root@monitor01 ansible]# cat edit_passwd.yml 
- hosts: monitor
  remote_user: root
  vars:
    - name1: test
    - chpass: 1a2b
  tasks:
    - name: change pasword
      user: name={{ name1 }}  password={{ chpass | password_hash('sha512') }}  update_password=always

你可能感兴趣的:(ansible 示例)