1
0
Fork 0
mirror of https://github.com/DO1JLR/ansible_role_nginx.git synced 2024-08-16 16:19:48 +02:00
ansible_role_nginx/tasks/default_site.yml

43 lines
1.3 KiB
YAML
Raw Normal View History

2020-11-02 04:51:35 +01:00
---
- name: Create default site plain http configuration
become: true
ansible.builtin.template:
src: 'templates/nginx/sites-available/default_http.j2'
2020-11-02 04:51:35 +01:00
dest: '/etc/nginx/sites-available/{{ inventory_hostname }}_http'
owner: root
group: root
mode: 'u=rw,g=r,o=r'
notify:
- systemctl reload nginx
2020-11-02 04:51:35 +01:00
- name: Create default site tls https configuration
become: true
ansible.builtin.template:
src: 'templates/nginx/sites-available/default_tls.j2'
2020-11-02 04:51:35 +01:00
dest: '/etc/nginx/sites-available/{{ inventory_hostname }}_tls'
owner: root
group: root
mode: 'u=rw,g=r,o=r'
notify:
- systemctl reload nginx
2020-11-02 04:51:35 +01:00
- name: Enable default site plain http configuration
become: true
ansible.builtin.file:
2020-11-02 04:51:35 +01:00
src: '/etc/nginx/sites-available/{{ inventory_hostname }}_http'
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_http'
state: link
notify:
- systemctl reload nginx
2020-11-02 04:51:35 +01:00
# Note: Done by acmetool after sucessfully obtaining a suitable certificate
- name: Enable default site configuration
become: true
ansible.builtin.file:
src: '/etc/nginx/sites-available/{{ inventory_hostname }}_tls'
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_tls'
state: link
notify:
- systemctl reload nginx
when: not nginx__acmetool_enabled