42 lines
862 B
YAML
42 lines
862 B
YAML
- name: Install Nginx
|
|
package:
|
|
name: nginx
|
|
state: present
|
|
|
|
- name: Create web root for landing page
|
|
file:
|
|
path: "{{ nginx_webroot }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Deploy landing page HTML
|
|
copy:
|
|
content: |
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head><title>Welcome</title></head>
|
|
<body>
|
|
<h1>Welcome to Matrix!</h1>
|
|
<p>Visit <a href="/_matrix">Matrix</a></p>
|
|
</body>
|
|
</html>
|
|
dest: "{{ nginx_webroot }}/index.html"
|
|
mode: '0644'
|
|
|
|
- name: Deploy Nginx config
|
|
template:
|
|
src: nginx/default.conf.j2
|
|
dest: "/etc/nginx/conf.d/{{ matrix_domain }}.conf"
|
|
mode: '0644'
|
|
|
|
- name: Remove default config (optional)
|
|
file:
|
|
path: "/etc/nginx/conf.d/default.conf"
|
|
state: absent
|
|
|
|
- name: Restart & enable Nginx
|
|
service:
|
|
name: nginx
|
|
state: restarted
|
|
enabled: yes
|