My virtual machine has a setting that when the first time a user logs in, it creates a home directory for the user automatically if the user does not have a home directory.
In my script, I want to achieve: Log in as different users so that they all have home directory setup. But I’m not sure how to do it.
I tried to write this in my task:
- name: Create home dir
remote_user: testuser2
shell: /usr/bin/whoami
But it threw an exception:
OpenSSH_5.9p1-hpn13v12 Debian-ts14, OpenSSL 0.9.8zc 15 Oct 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: key names ok: [ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ssh-rsa,ssh-dss]
debug1: /etc/ssh/ssh_config line 13: Applying options for *
debug1: auto-mux: Trying existing master
ControlPath too long
While if I change the remote_user to a user that has already had a home directory in the machine, it will finish successfully.