Created
August 14, 2017 08:00
-
-
Save nitanka/85b912d02c6a90c4de288f5c7972ea68 to your computer and use it in GitHub Desktop.
Ansible: Add user to the server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Creating new user | |
user: | |
name: <username> | |
group: <groupname> | |
state: present | |
shell: /bin/bash #default shell | |
home: <path_to_home> #example /home/username | |
#if we donot want home directory to be created,then use createhome: no | |
password: "{{ lookup('env', 'PASSWD') }}" #set the password for the user | |
- name: adding keys to the server | |
authorized_key: | |
user: <username> | |
key: "{{ lookup('file', 'path_to/.ssh/id_rsa.pub') }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment