Hello,
I’m trying to creating directories based on different inventory_hostname with with_items but it seems doesn’t work:
in hosts:
[website-static-pages] server1 server2
in vars.yml:
`
enabled_sites:
server1:
- website1.com
- website2.com
- website3.com
server2: - website4.com
- website5.com
`
in task.yml:
`
- name: create site public directories
file: path=/srv/www/{{ item }}/public_html/ state=directory
with_items: enabled_sites[“{{ inventory_hostname }}”]
`
It seems that this syntax doesn’t work with Ansible, any idea?
Thank you!