I’ve been trying to use the group and user module to create a user account that has SSH rights.
the tasks i’m running are:
- name: Add jenkins user
user: name=jenkins comment=Jenkins password=foobar system=yes
sudo: yes
and although the user is created SSH isn’t set up properly: If I try to connect as the user jenkins I get authenticated but the connection immediately closes.
previously I’d used a sequence of shell commands:
- name: Create Jenkins user
shell: “{{item}}”
with_items: - “dscl . -create /Users/jenkins”
- “dscl . -create /Users/jenkins UserShell /bin/bash”
- “dscl . -create /Users/jenkins RealName ‘Jenkins’”
- “dscl . -create /Users/jenkins UniqueID {{unique_id_generator.stdout}}”
- “dscl . -create /Users/jenkins PrimaryGroupID 20”
- “dscl . -create /Users/jenkins NFSHomeDirectory /Users/jenkins”
- “createhomedir -c > /dev/null”
- “dscl . append /Groups/com.apple.access_ssh user jenkins”
- “dscl . append /Groups/com.apple.access_ssh groupmembers
dscl . read /Users/jenkins GeneratedUID | cut -d ' ' -f 2
” - “dscl . -passwd /Users/jenkins foobar”
sudo: yes
and this does work
Any ideas or is this a bug in the user module?