ansible/roles/nginx/tasks/configure.yml
2023-06-10 08:04:09 +03:00

45 lines
1.1 KiB
YAML

---
- block:
- name: configure nginx.conf
copy:
content: "{{ nginx['nginx.conf'] }}"
dest: "/etc/nginx/nginx.conf"
notify: reload nginx
when: nginx['nginx.conf'] is defined
- name: add configs nginx to conf.d
copy:
content: "{{ item.data }}"
dest: "/etc/nginx/conf.d/{{ item.name }}"
loop: "{{ nginx['conf.d'] }}"
notify: reload nginx
when: nginx['conf.d'] is defined
- name: create stream.d dir
file:
name: /etc/nginx/stream.d
state: directory
- name: add configs nginx to stream.d
copy:
content: "{{ item.data }}"
dest: "/etc/nginx/stream.d/{{ item.name }}"
loop: "{{ nginx['stream.d'] }}"
notify: reload nginx
when: nginx['stream.d'] is defined
- name: check if ssl dir exist
file: path=/etc/nginx/ssl state=directory
when: nginx.ssl is defined
- name: add ssl certs and keys
copy:
content: "{{ item.data }}"
dest: "/etc/nginx/ssl/{{ item.name }}"
loop: "{{ nginx.ssl }}"
notify: reload nginx
when: nginx.ssl is defined
tags:
- nginx-configure