Better readability

This commit is contained in:
Emilien Mantel
2017-10-03 17:57:35 +02:00
parent 54dd1ef3c0
commit de40c07ac5
5 changed files with 82 additions and 48 deletions

View File

@@ -7,20 +7,20 @@
when: item + '=dynamic' not in nginx_modules
- name: APT | Install nginx modules
apt: >
pkg="libnginx-mod-{{ item | replace('_', '-') }}"
state=present
default_release={{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}
apt:
pkg: "libnginx-mod-{{ item | replace('_', '-') }}"
state: present
default_release: "{{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}"
with_items: "{{ nginx_dyn_modules }}"
when: ansible_distribution == 'Debian'
- name: FILE | Creates modules directories
file: >
path="{{ nginx_etc_dir}}/{{ item }}"
state=directory
mode=0755
owner=root
group=root
file:
path: "{{ nginx_etc_dir}}/{{ item }}"
state: directory
mode: 0755
owner: root
group: root
with_items: ['modules-available', 'modules-enabled']
# TODO: manage freebsd

View File

@@ -1,21 +1,26 @@
---
- name: PKGNG | Install nginx and related tools
pkgng: name={{ item }} state=present
pkgng:
name: "{{ item }}"
state: present
with_items:
- "{{ nginx_pkgng_package }}"
- py27-passlib
- curl
- name: FILE | Create configuration dir (like Debian)
file: path="{{ nginx_etc_dir }}/{{ item }}" state=directory
file:
path: "{{ nginx_etc_dir }}/{{ item }}"
state: directory
with_items:
- conf.d
- sites-available
- sites-enabled
- name: STAT | Check fastcgi.conf
stat: path={{ nginx_etc_dir }}/fastcgi.conf
stat:
path: "{{ nginx_etc_dir }}/fastcgi.conf"
register: conf
- name: COPY | config
@@ -24,23 +29,25 @@
notify: reload nginx
- name: LINEINFILE | Add fastcgi config
lineinfile: >
line="fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;"
dest="{{ nginx_etc_dir }}/fastcgi.conf"
lineinfile:
line: "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;"
dest: "{{ nginx_etc_dir }}/fastcgi.conf"
notify: reload nginx
- name: COPY | Populate proxy_params
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"
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"
- name: FILE | Create log directory
file: >
path={{ nginx_log_dir }}
owner={{ nginx_user }}
group=wheel
mode=0755
state=directory
file:
path: "{{ nginx_log_dir }}"
owner: "{{ nginx_user }}"
group: wheel
mode: 0755
state: directory
- name: SERVICE | Enable nginx
service: name=nginx enabled=yes
service:
name: nginx
enabled: yes