1234567891011121314151617181920 |
- - name: Create directories for HTML documents
- file: state=directory path={{ item }} group=www-data owner={{ main_user_name }}
- with_items: "{{ virtual_domains | json_query('[*].doc_root') | unique }}"
-
- - name: Create the Apache sites config files
- template:
- src=etc_apache2_sites-available_blog.j2
- dest=/etc/apache2/sites-available/{{ item.name }}.conf
- owner=root
- group=root
- with_items: "{{ virtual_domains }}"
-
- - name: Remove old sites-enabled symlinks (new ones will be created by a2ensite)
- file: path=/etc/apache2/sites-enabled/{{ item }}.conf state=absent
- with_items: "{{ virtual_domains | json_query('[*].name') }}"
-
- - name: Enable Apache sites (creates new sites-enabled symlinks)
- command: a2ensite {{ item }}.conf creates=/etc/apache2/sites-enabled/{{ item }}.conf
- notify: restart apache
- with_items: "{{ virtual_domains | json_query('[*].name') }}"
|