美文网首页
ansible modify password

ansible modify password

作者: 毛里求疵 | 来源:发表于2019-12-11 17:02 被阅读0次
# 方式1
--- p1.yml
- hosts: test
    gather_facts: false
    tasks:
    - name: change user passwd
      user: name={{ item.name }} password={{ item.chpass | password_hash('sha512') }} update_password=always
      with_items:
           - { name: 'root', chpass: 'admin#123' }
           - { name: 'test', chpass: 'admin@123' }

# 方式2
--- p2.yml
--- ansible-playbook p2.yml -e -e "username =test userpwd=admin#123"
- hosts: test
      gather_facts: false
      tasks:
      - name: Change password
        user: name={{ username }}  password={{ userpwd | password_hash('sha512') }}  update_password=always
# Tip
password may contain:0 ~ 9  A ~ Z  a ~ z  @  #  _ %  * ^ ~ ( ) 
possible without $  !

相关文章

网友评论

      本文标题:ansible modify password

      本文链接:https://www.haomeiwen.com/subject/lyqagctx.html