Skip to content

Instantly share code, notes, and snippets.

@NetguruGist
Created February 14, 2017 09:57
Show Gist options
  • Save NetguruGist/15acad05f96f917d8678b325a9184f92 to your computer and use it in GitHub Desktop.
Save NetguruGist/15acad05f96f917d8678b325a9184f92 to your computer and use it in GitHub Desktop.
- name: "First things first - install latest patches"
apt: update_cache=yes upgrade=full
- name: "First things first - create random root password"
apt: name={{ item }} state=present
with_items:
- pwgen
- whois
- shell: /usr/bin/pwgen -s 40 1
register: root_password
- shell: "/usr/bin/mkpasswd {{ root_password.stdout }} --method=SHA-512"
register: root_crypted_password
- user: name=root password={{ root_crypted_password.stdout }}
- debug: msg="Password for user 'root' has been set to {{ root_password.stdout }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment