ansible-roles/smartgears/smartgears-nginx-frontend/tasks/main.yml

42 lines
1.8 KiB
YAML

---
# Install the nginx virtualhosts
- name: Install the nginx virtualhost, if a specific one has been defined
template: src={{ item.servername }}-virtualhost.j2 dest=/etc/nginx/sites-available/{{ item.servername }} owner=root group=root mode=0444
with_items: '{{ tomcat_m_instances }}'
when: not smartgears_install_generic_virthost
notify: Reload nginx
tags: [ 'nginx', 'virtualhost' ]
- name: Install the nginx generic virtualhost
template: src=generic-smartgears-virtualhost.j2 dest=/etc/nginx/sites-available/{{ item.servername }} owner=root group=root mode=0444
with_items: '{{ tomcat_m_instances }}'
when: smartgears_install_generic_virthost
notify: Reload nginx
tags: [ 'nginx', 'virtualhost' ]
- name: Enable the nginx virtualhosts
file: src=/etc/nginx/sites-available/{{ item.servername }} dest=/etc/nginx/sites-enabled/smartgears_{{ item.smartgears_id }}.conf state=link
with_items: '{{ tomcat_m_instances }}'
notify: Reload nginx
tags: [ 'nginx', 'virtualhost' ]
- name: Remove the old hostname based virtualhost filename
file: dest=/etc/nginx/sites-enabled/{{ item.servername }}.conf state=absent
with_items: '{{ tomcat_m_instances }}'
notify: Reload nginx
tags: [ 'nginx', 'virtualhost' ]
- name: Remove the old ubuntu.conf virtualhost filename
file: dest=/etc/nginx/sites-enabled/ubuntu.conf state=absent
with_items: '{{ tomcat_m_instances }}'
notify: Reload nginx
tags: [ 'nginx', 'virtualhost' ]
- name: Give the smartgears user access to the document root, and create it if needed
file: dest={{ item.web_document_root}} state=directory owner={{ item.user }} group={{ item.user }} mode=0755
with_items: '{{ tomcat_m_instances }}'
when: smartgears_nginx_rw_html_root
notify: Reload nginx
tags: [ 'nginx', 'virtualhost', 'web_root' ]