Guest User

Untitled

a guest
Feb 14th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. - name: "First things first - install latest patches"
  2.  
  3. apt: update_cache=yes upgrade=full
  4.  
  5. - name: "First things first - create random root password"
  6.  
  7. apt: name={{ item }} state=present
  8.  
  9. with_items:
  10.  
  11. - pwgen
  12.  
  13. - whois
  14.  
  15. - shell: /usr/bin/pwgen -s 40 1
  16.  
  17. register: root_password
  18.  
  19. - shell: "/usr/bin/mkpasswd {{ root_password.stdout }} --method=SHA-512"
  20.  
  21. register: root_crypted_password
  22.  
  23. - user: name=root password={{ root_crypted_password.stdout }}
  24.  
  25. - debug: msg="Password for user 'root' has been set to {{ root_password.stdout }}"
Add Comment
Please, Sign In to add comment