2020-04-13 14:46:45 +02:00
|
|
|
- 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
|
2020-12-02 17:22:59 +01:00
|
|
|
owner: "{{ nginx_owner }}"
|
|
|
|
group: "{{ nginx_group }}"
|
2020-04-13 14:46:45 +02:00
|
|
|
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 }}"
|
2020-12-02 17:22:59 +01:00
|
|
|
owner: "{{ nginx_owner }}"
|
|
|
|
group: "{{ nginx_group }}"
|
2020-04-13 14:46:45 +02:00
|
|
|
mode: 0644
|
|
|
|
notify:
|
|
|
|
- reload nginx
|