change user password for user Joe (user Fred running the cmd as sudo on the target box)
# 1 install passlib
pip install passlib
#2 update the pw, using a hash
ansible targethost -s -m user -a "name=joe update_password=always password={{ 'MyNewPassword' | password_hash('sha512') }}" -u fred --ask-sudo-pass
copy public ssh key to remote authorized_keys file
- hosts: targetHost
tasks:
- name: update nessus SSH keys
become_user: root
become_method: sudo
become: true
authorized_key:
user: nessus
key: "{{ lookup('pipe','cat ../files/ssh_keys/nessus.pub') }}"
state: present
No comments:
Post a Comment