-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yaml
41 lines (37 loc) · 884 Bytes
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- name: Setup nginx
hosts: all
become: true
vars:
nginx_file: mysite
site_a: /etc/nginx/sites-available
site_e: /etc/nginx/sites-enabled
vars_prompt:
- name: nginx
prompt: Install nginx?
private: false
default: false
tasks:
- name: Install nginx
ansible.builtin.apt:
name: nginx
state: present
update_cache: true
when: nginx | bool
- name: Setup nginx
ansible.builtin.copy:
src: "{{nginx_file}}"
dest: "{{site_a}}"
notify:
- reload nginx
- name: Create symlink
ansible.builtin.file:
src: "{{site_a}}/{{nginx_file}}"
dest: "{{site_e}}/{{nginx_file}}"
state: link
owner: root
group: root
notify:
- reload nginx
handlers:
- name: reload nginx
ansible.builtin.shell: nginx -s reload