diff options
Diffstat (limited to 'tasks/main.yml')
| -rw-r--r-- | tasks/main.yml | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/tasks/main.yml b/tasks/main.yml index 6f0d944..225662f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -18,15 +18,7 @@ - "{{nginx_conf_dir}}/conf.d" tags: - conf -- name: Create Acme Challenge directory - file: - path: /var/lib/acme-challenge - state: directory - owner: "{{nginx_conf_owner}}" - group: "{{nginx_conf_group}}" - mode: "0755" - tags: - - conf + - name: Create Robots directory file: path: /var/lib/nginx-robots @@ -69,44 +61,45 @@ tags: - robots - conf -- name: Install Main 'nginx.conf' - template: - src: nginx/nginx.conf + +- name: Install 'nginx.conf' + copy: + content: '{{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 tags: - conf -- name: Install custom 'nginx.conf' - template: - src: "{{ansible_hostname}}/nginx/nginx.conf" - dest: "{{nginx_conf_dir}}/nginx.conf" + +- name: Install Nginx Snippets + copy: + content: '{{item.value}}' + dest: "{{nginx_conf_dir}}/{{item.key}}" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" - when: nginx_custom_template - notify: - - Restart Nginx + loop: '{{nginx_includes | dict2items}}' + when: 'nginx_includes is defined' + notify: Restart Nginx tags: - conf -- name: Install Other Nginx templates - template: - src: "nginx/{{item}}" - dest: "{{nginx_conf_dir}}/{{item}}" + +- name: Install Nginx conf.d entires + copy: + content: '{{item.value}}' + dest: "{{nginx_conf_dir}}/conf.d/{{item.key}}" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" - loop: - - acme-challenge - - acl - notify: - - Restart Nginx + loop: '{{nginx_confd | dict2items}}' + when: 'nginx_confd is defined' + notify: Restart Nginx tags: - conf + - name: Install Htpasswd copy: src: '{{nginx_htpasswd}}' |
