2022-01-01 07:16:10 +03:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
|
|
|
connection: local
|
|
|
|
tasks:
|
|
|
|
- name: Install nginx
|
|
|
|
become: yes
|
|
|
|
apt:
|
|
|
|
name: nginx-light
|
|
|
|
update_cache: yes
|
|
|
|
state: latest
|
|
|
|
- name: Create dir
|
|
|
|
file:
|
|
|
|
path: /var/www
|
|
|
|
state: directory
|
|
|
|
- name: Copy repo files
|
|
|
|
become: yes
|
|
|
|
copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /var/www
|
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
with_fileglob:
|
|
|
|
- src/*
|
2022-01-09 23:47:32 +03:00
|
|
|
- name: Copy index file
|
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: template/index.jinja2
|
|
|
|
dest: /var/www/index.html
|
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
mode: 0644
|
2022-01-01 07:16:10 +03:00
|
|
|
- name: Copy config file
|
|
|
|
become: yes
|
|
|
|
copy:
|
|
|
|
src: files/nginx.conf
|
|
|
|
dest: /etc/nginx/nginx.conf
|
|
|
|
owner: root
|
|
|
|
notify:
|
|
|
|
- Reload nginx
|
|
|
|
handlers:
|
|
|
|
- name: Reload nginx
|
|
|
|
become: yes
|
2022-01-03 18:34:43 +03:00
|
|
|
ignore_errors: yes
|
2022-01-01 07:16:10 +03:00
|
|
|
service:
|
|
|
|
name: nginx
|
|
|
|
state: restarted
|