I have a virtual machine that when first login as a user, it will create 
the home directory for the user if it doesn't have one.

So just sth like, 
$ ssh username@myhostname
$ Creating directory '/home/username'.

How could I use Ansible to do that(just login in order to generate a home 
directory)? 

I tried this in playbook:
---
- hosts: all
  gather_facts: no
  remote_user: theusername
  tasks:
    - name: Auto generate user home directory
      shell: /usr/bin/whoami

It threw an exception saying "ControlPath too long". But when I do the same 
thing with a user that has a home directory in the machine, it will succeed.
The control path 
is: 
'ControlPath=/net/myhostname/userhome/myusername/.ansible/cp/ansible-ssh-%h-%p-%r'

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/228dc9ac-d213-4afb-a3c1-6fffec6b06a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to