initial commit
This commit is contained in:
28
roles/nginx/tasks/configure.yml
Normal file
28
roles/nginx/tasks/configure.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
- name: Create .htpasswd file
|
||||
htpasswd:
|
||||
path: "/etc/nginx/{{ location.basic_auth.file }}"
|
||||
name: "{{ location.basic_auth.user | default('admin') }}"
|
||||
password: "{{ location.basic_auth.password }}"
|
||||
state: present
|
||||
create: yes
|
||||
owner: "{{ nginx_user }}"
|
||||
group: "{{ nginx_user }}"
|
||||
mode: 0600
|
||||
loop: "{{ nginx_server.locations }}"
|
||||
loop_control:
|
||||
loop_var: location
|
||||
label: "{{ location.path }}"
|
||||
when: "location.basic_auth is defined"
|
||||
|
||||
notify:
|
||||
- reload nginx
|
||||
|
||||
- name: Copy Nginx config
|
||||
template:
|
||||
src: "{{ nginx_template_file }}"
|
||||
dest: "{{ nginx_config_dir }}/{{ nginx_config_file }}"
|
||||
owner: "{{ nginx_user }}"
|
||||
group: "{{ nginx_user }}"
|
||||
mode: 0644
|
||||
notify:
|
||||
- reload nginx
|
||||
4
roles/nginx/tasks/main.yml
Normal file
4
roles/nginx/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- name: Configure Nginx
|
||||
import_tasks: configure.yml
|
||||
tags: nginx
|
||||
Reference in New Issue
Block a user