root_changepass_ssh.yml 459 Bytes
# cat change_user_pass.yml
---
- hosts: sndev
  sudo: yes
  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: 'vion' }
  - name: change ssh config
    command: sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
  - name: service restart
    command: service ssh restart