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:
with_items:
- /srv/www
- /dir/foo
- /dir/bar
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.