- name: Create directory for blog HTML
file: state=directory path=/var/www/{{ domain }} group=www-data owner=www-data
- name: Rename existing Apache blog virtualhost
command: mv /etc/apache2/sites-available/{{ domain }} /etc/apache2/sites-available/{{ domain }}.conf removes=/etc/apache2/sites-available/{{ domain }}
- name: Remove old sites-enabled/{{ domain }} symlink (new one will be created by a2ensite)
command: rm /etc/apache2/sites-enabled/{{ domain }} removes=/etc/apache2/sites-enabled/{{ domain }}
- name: Configure the Apache HTTP server for the blog
template: src=etc_apache2_sites-available_blog.j2 dest=/etc/apache2/sites-available/{{ domain }}.conf group=root owner=root
- name: Enable blog site
command: a2ensite {{ domain }}.conf creates=/etc/apache2/sites-enabled/{{ domain }}.conf
notify: restart apache