automation/deployer/roles/deploy/tasks/nginx.yml

22 lines
620 B
YAML

# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Copy host config to /etc/nginx/sites-available
copy:
remote_src: yes
src: "{{ sites_path }}/{{ site.slug }}/nginx.host"
dest: "/etc/nginx/sites-available/{{ site.url }}"
become: yes
- name: "Symlink nginx configuration to sites-enabled"
file:
src: "/etc/nginx/sites-available/{{ site.url }}"
dest: "/etc/nginx/sites-enabled/{{ site.url }}"
state: link
become: yes
notify: Restart nginx
- name: Verify nginx configuration
command: "nginx -t"
any_errors_fatal: true
become: yes