aboutsummaryrefslogtreecommitdiff
path: root/tasks/main.yml
blob: 3ee74e264ab87c1ecc5e70c787de9127ecb0b757 (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: Include install tasks
  include_tasks: install.yml
- name: Include enable tasks
  include_tasks: enable.yml
- name: Lock down and setup configuration directories
  file:
    path: '{{item}}'
    state: directory
    owner: "{{nginx_conf_owner}}"
    group: "{{nginx_conf_group}}"
    mode: "{{nginx_conf_dir_mode}}"
  loop:
    - "{{nginx_conf_dir}}"
    - "{{nginx_conf_dir}}/conf.d"
- name: Create Acme Challenge directory
  file:
    path: /var/lib/acme-challenge
    state: directory
    owner: "{{nginx_conf_owner}}"
    group: "{{nginx_conf_group}}"
    mode: "0755"
- name: Install Main 'nginx.conf'
  template:
    src: nginx/nginx.conf
    dest: "{{nginx_conf_dir}}/nginx.conf"
    owner: "{{nginx_conf_owner}}"
    group: "{{nginx_conf_group}}"
    mode: "{{nginx_conf_file_mode}}"
  when: not nginx_custom_template
  notify:
    - Restart Nginx
- name: Install custom 'nginx.conf'
  template:
    src: "{{ansible_hostname}}/nginx/nginx.conf"
    dest: "{{nginx_conf_dir}}/nginx.conf"
    owner: "{{nginx_conf_owner}}"
    group: "{{nginx_conf_group}}"
    mode: "{{nginx_conf_file_mode}}"
  when: nginx_custom_template
  notify:
    - Restart Nginx
- name: Install Other Nginx templates
  template:
    src: "nginx/{{item}}"
    dest: "{{nginx_conf_dir}}/{{item}}"
    owner: "{{nginx_conf_owner}}"
    group: "{{nginx_conf_group}}"
    mode: "{{nginx_conf_file_mode}}"
  loop:
    - acme-challenge
    - acl
  notify:
  - Restart Nginx