Skip to content

Instantly share code, notes, and snippets.

@NetguruGist
Created February 14, 2017 10:00
Show Gist options
  • Save NetguruGist/193b4a3300f8171e3f39cd83335ea327 to your computer and use it in GitHub Desktop.
Save NetguruGist/193b4a3300f8171e3f39cd83335ea327 to your computer and use it in GitHub Desktop.
- name: "Add your user"
user: name=deploy shell=/bin/bash group=sudo
- authorized_key: user=deploy key="SSH_KEY" exclusive=yes
- shell: /usr/bin/pwgen -s 40 1
register: deploy_password
- shell: "/usr/bin/mkpasswd{% raw %} {{ deploy_password.stdout }}{% endraw %} --method=SHA-512"
register: deploy_crypted_password
- user: name=deploy password={% raw %}{{ deploy_crypted_password.stdout }}{% endraw %}
- debug: msg="Password for user 'deploy' has been set to{% raw %} {{ deploy_password.stdout }}{% endraw %}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment