ansible-pet/1/roles/nginx/tasks/main.yml

50 lines
993 B
YAML
Raw Normal View History

2021-02-25 15:49:59 +03:00
---
- name: Install nginx package
apt:
name: nginx
state: present
- name: Install certbot package
apt:
2021-02-25 16:31:59 +03:00
name: ['certbot', 'python3-certbot-nginx']
state: present
2021-02-25 17:50:16 +03:00
- name: install nginx config
template:
src: files/nginx.conf
dest: /etc/nginx/nginx.conf
owner: www-data
- name: remove default config
file:
path: /etc/nginx/sites-enabled/default
state: absent
owner: www-data
- name: install site's configs
template:
src: files/sites-enabled/{{ item }}
dest: /etc/nginx/sites-enabled/{{ item }}
owner: www-data
loop: ['wiki.conf', 'root.conf', 'pma.conf', 'default_server.conf', 'cloud.conf']
2021-02-25 18:05:51 +03:00
- name: create dirs
file:
path: /var/www/{{item}}
state: directory
owner: www-data
loop: ['pma','cloud','wiki','default','root']
2021-02-25 17:50:16 +03:00
- name: stop nginx
service:
name: nginx
state: stopped
- name: Get certs using certbot
shell: echo "cock"
- name: start nginx
service:
name: nginx
state: started