ansible-nginx/tasks/install_FreeBSD.yml

54 lines
1.3 KiB
YAML
Raw Normal View History

2016-03-05 21:07:39 +07:00
---
- name: PKGNG | Install nginx and related tools
2017-10-03 22:57:35 +07:00
pkgng:
name: "{{ item }}"
state: present
2016-03-05 21:07:39 +07:00
with_items:
2016-03-07 18:08:34 +07:00
- "{{ nginx_pkgng_package }}"
2016-03-05 21:07:39 +07:00
- py27-passlib
- curl
- name: FILE | Create configuration dir (like Debian)
2017-10-03 22:57:35 +07:00
file:
path: "{{ nginx_etc_dir }}/{{ item }}"
state: directory
2016-03-05 21:07:39 +07:00
with_items:
- conf.d
- sites-available
- sites-enabled
2016-03-05 21:36:25 +07:00
2016-03-05 23:26:05 +07:00
- name: STAT | Check fastcgi.conf
2017-10-03 22:57:35 +07:00
stat:
path: "{{ nginx_etc_dir }}/fastcgi.conf"
2016-03-05 23:26:05 +07:00
register: conf
- name: COPY | config
command: "cp {{ nginx_etc_dir }}/fastcgi_params {{ nginx_etc_dir }}/fastcgi.conf"
when: not conf.stat.exists
notify: reload nginx
- name: LINEINFILE | Add fastcgi config
2017-10-03 22:57:35 +07:00
lineinfile:
line: "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;"
dest: "{{ nginx_etc_dir }}/fastcgi.conf"
2016-03-05 23:26:05 +07:00
notify: reload nginx
2016-03-05 21:36:25 +07:00
- name: COPY | Populate proxy_params
2017-10-03 22:57:35 +07:00
copy:
content: "proxy_set_header Host $http_host;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;"
dest: "{{ nginx_etc_dir }}/proxy_params"
2016-03-16 04:49:19 +07:00
- name: FILE | Create log directory
2017-10-03 22:57:35 +07:00
file:
path: "{{ nginx_log_dir }}"
owner: "{{ nginx_user }}"
group: wheel
mode: 0755
state: directory
2016-03-16 05:12:17 +07:00
- name: SERVICE | Enable nginx
2017-10-03 22:57:35 +07:00
service:
name: nginx
enabled: yes