# Playbook to create multiple user directories based on user input passed in from playbook execution

**URL:** <https://forum.ansible.com/t/playbook-to-create-multiple-user-directories-based-on-user-input-passed-in-from-playbook-execution/37287>\
**Category:** Ansible Project\
**Created:** [November 1, 2022, 3:25pm UTC](https://forum.ansible.com/t/playbook-to-create-multiple-user-directories-based-on-user-input-passed-in-from-playbook-execution/37287 "2022-11-01T15:25:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [November 1, 2022, 3:25pm UTC](https://forum.ansible.com/t/playbook-to-create-multiple-user-directories-based-on-user-input-passed-in-from-playbook-execution/37287/1 "2022-11-01T15:25:58Z")

</div>

Hello all,

I have a playbook which creates sftp user accounts based on information passed during playbook execution. I would like to create multiple directories based on what the user running the playbook enters.

- name: Create subdirectories  
file:  
path: /storage/{{ prod\_or\_test }}/sftp/{{ obfusicatedusername }}/{{ dirs }}  
state: directory  
recurse: yes  
owner: ‘{{ obfusicatedusername }}’  
group: sftp\_admins

I pass the information via: --extra-vars: obfusicatedusername=testy123 password=mypassword prod\_or\_test=TEST\_SFTP dirs=Inbound

The issue is some sftp users want more than 1 directory, while others want 2 or more…

I know I could do something like:

```auto
with_items:
  - /srv/www
  - /dir/foo
  - /dir/bar

```

```auto

```

```auto

 Just not sure how to handle that if sometimes it could be one, other times 2 or more. Any help or guidance would be appreciated.

```
