I am putting together an Ansible Playbook designed to build webservers. However I am stuck when trying to use with_fileglob
because Ansible keeps reporting that it's skipping the copy of nginx vhost files.
My script looks like this:
- name: Nginx | Copy vhost files
copy: src={{ item }} dest=/etc/nginx/sites-available owner=root group=root mode=600
with_fileglob:
- "{{ templates_dir }}/nginx/sites-available/*"
notify
- nginx-restart:
{{ templates }}
has been defined elsewhere as roles/common/templates. In this directory I have a file called webserver1 that I'm hoping Ansible will copy into /etc/nginx/sites-available/
I have found other people discussing this issue but no responses have helped me solve this problem. Why would Ansible be skipping files?
Edit: I should point out that I want to use with_fileglob
(rather than straight copy) as I want to iterate over other virtual hosts in the future.
templates_dir: src="{{ base_dir }}/roles/common/templates"
when I should have been using ` templates_dir: "{{ base_dir }}/roles/common/templates"` – Dubby