Better readability

pull/35/head
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

View File

@ -1,7 +1,9 @@
---
- name: APT | Install web apps
pkgng: pkg={{ item }} state=present
pkgng:
pkg: "{{ item }}"
state: present
with_items:
- nagios
- backuppc
@ -12,17 +14,17 @@
creates=/usr/local/etc/backuppc/config.pl
- name: FILE | Fix backuppc permissions
file: >
path=/usr/local/etc/backuppc/config.pl
owner=backuppc
group=backuppc
file:
path: /usr/local/etc/backuppc/config.pl
owner: backuppc
group: backuppc
- name: FILE | Fix fcgiwrap permission
file: >
path={{ nginx_fcgiwrap_sock }}
mode=0640
owner={{ nginx_user }}
group={{ nginx_user }}
file:
path: "{{ nginx_fcgiwrap_sock }}"
mode: 0640
owner: "{{ nginx_user }}"
group: "{{ nginx_user }}"
#
# We don't manage BackupPC on FreeBSD... too dirty. :/

View File

@ -1,25 +1,35 @@
---
- name: APT_REPOSITORY | Install backports
apt_repository: repo='deb http://httpredir.debian.org/debian {{ ansible_distribution_release }}-backports main' state=present
apt_repository:
repo: 'deb http://httpredir.debian.org/debian {{ ansible_distribution_release }}-backports main'
state: present
- block:
- name: APT | Install DotDeb key
apt_key: url='http://www.dotdeb.org/dotdeb.gpg' state=present
apt_key:
url: 'http://www.dotdeb.org/dotdeb.gpg'
state: present
- name: APT_REPOSITORY | Install dotdeb (PHP 7)
apt_repository: repo='deb http://packages.dotdeb.org {{ ansible_distribution_release }} all' state=present
apt_repository:
repo: 'deb http://packages.dotdeb.org {{ ansible_distribution_release }} all'
state: present
- name: LINEFILEFILE | Dotdeb priority (prevent install nginx from dotdeb)
copy: >
content="Package: *\nPin: release o=packages.dotdeb.org\nPin-Priority: 100"
dest=/etc/apt/preferences
copy:
content: "Package: *\nPin: release o=packages.dotdeb.org\nPin-Priority: 100"
dest: /etc/apt/preferences
when: ansible_distribution_release == 'jessie' and dotdeb
- name: APT | Install needed packages
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present
apt:
pkg: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
state: present
with_items:
- curl
- fcgiwrap
@ -28,21 +38,31 @@
- vim
- name: APT | Install PHP5.6
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present
apt:
pkg: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
state: present
with_items:
- php5-fpm
- php5-sqlite
when: nginx_php56
- name: APT | Install PHP7
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present
apt:
pkg: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
state: present
with_items:
- php7.0-fpm
- php7.0-sqlite3
when: nginx_php70
- name: SERVICE | Force start services
service: name="{{ item.name }}" state=started
service:
name: "{{ item.name }}"
state: started
register: sf
with_items:
- { name: 'php5-fpm', cond: "{{ nginx_php56 }}" }

View File

@ -10,7 +10,9 @@
port: 9000
- name: PKGNG | Install needed packages
pkgng: pkg={{ item }} state=present
pkgng:
pkg: "{{ item }}"
state: present
with_items:
- php56
- curl
@ -18,7 +20,10 @@
- nghttp2
- name: SERVICE | Force start services
service: name={{ item }} state=started enabled=yes
service:
name: "{{ item }}"
state: started
enabled: yes
register: sf
with_items:
- php-fpm