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

View File

@ -1,21 +1,26 @@
--- ---
- name: PKGNG | Install nginx and related tools - name: PKGNG | Install nginx and related tools
pkgng: name={{ item }} state=present pkgng:
name: "{{ item }}"
state: present
with_items: with_items:
- "{{ nginx_pkgng_package }}" - "{{ nginx_pkgng_package }}"
- py27-passlib - py27-passlib
- curl - curl
- name: FILE | Create configuration dir (like Debian) - 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: with_items:
- conf.d - conf.d
- sites-available - sites-available
- sites-enabled - sites-enabled
- name: STAT | Check fastcgi.conf - name: STAT | Check fastcgi.conf
stat: path={{ nginx_etc_dir }}/fastcgi.conf stat:
path: "{{ nginx_etc_dir }}/fastcgi.conf"
register: conf register: conf
- name: COPY | config - name: COPY | config
@ -24,23 +29,25 @@
notify: reload nginx notify: reload nginx
- name: LINEINFILE | Add fastcgi config - name: LINEINFILE | Add fastcgi config
lineinfile: > lineinfile:
line="fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;" line: "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;"
dest="{{ nginx_etc_dir }}/fastcgi.conf" dest: "{{ nginx_etc_dir }}/fastcgi.conf"
notify: reload nginx notify: reload nginx
- name: COPY | Populate proxy_params - name: COPY | Populate proxy_params
copy: > 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;" 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" dest: "{{ nginx_etc_dir }}/proxy_params"
- name: FILE | Create log directory - name: FILE | Create log directory
file: > file:
path={{ nginx_log_dir }} path: "{{ nginx_log_dir }}"
owner={{ nginx_user }} owner: "{{ nginx_user }}"
group=wheel group: wheel
mode=0755 mode: 0755
state=directory state: directory
- name: SERVICE | Enable nginx - 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 - name: APT | Install web apps
pkgng: pkg={{ item }} state=present pkgng:
pkg: "{{ item }}"
state: present
with_items: with_items:
- nagios - nagios
- backuppc - backuppc
@ -12,17 +14,17 @@
creates=/usr/local/etc/backuppc/config.pl creates=/usr/local/etc/backuppc/config.pl
- name: FILE | Fix backuppc permissions - name: FILE | Fix backuppc permissions
file: > file:
path=/usr/local/etc/backuppc/config.pl path: /usr/local/etc/backuppc/config.pl
owner=backuppc owner: backuppc
group=backuppc group: backuppc
- name: FILE | Fix fcgiwrap permission - name: FILE | Fix fcgiwrap permission
file: > file:
path={{ nginx_fcgiwrap_sock }} path: "{{ nginx_fcgiwrap_sock }}"
mode=0640 mode: 0640
owner={{ nginx_user }} owner: "{{ nginx_user }}"
group={{ nginx_user }} group: "{{ nginx_user }}"
# #
# We don't manage BackupPC on FreeBSD... too dirty. :/ # We don't manage BackupPC on FreeBSD... too dirty. :/

View File

@ -1,25 +1,35 @@
--- ---
- name: APT_REPOSITORY | Install backports - 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: - block:
- name: APT | Install DotDeb key - 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) - 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) - name: LINEFILEFILE | Dotdeb priority (prevent install nginx from dotdeb)
copy: > copy:
content="Package: *\nPin: release o=packages.dotdeb.org\nPin-Priority: 100" content: "Package: *\nPin: release o=packages.dotdeb.org\nPin-Priority: 100"
dest=/etc/apt/preferences dest: /etc/apt/preferences
when: ansible_distribution_release == 'jessie' and dotdeb when: ansible_distribution_release == 'jessie' and dotdeb
- name: APT | Install needed packages - 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: with_items:
- curl - curl
- fcgiwrap - fcgiwrap
@ -28,21 +38,31 @@
- vim - vim
- name: APT | Install PHP5.6 - 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: with_items:
- php5-fpm - php5-fpm
- php5-sqlite - php5-sqlite
when: nginx_php56 when: nginx_php56
- name: APT | Install PHP7 - 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: with_items:
- php7.0-fpm - php7.0-fpm
- php7.0-sqlite3 - php7.0-sqlite3
when: nginx_php70 when: nginx_php70
- name: SERVICE | Force start services - name: SERVICE | Force start services
service: name="{{ item.name }}" state=started service:
name: "{{ item.name }}"
state: started
register: sf register: sf
with_items: with_items:
- { name: 'php5-fpm', cond: "{{ nginx_php56 }}" } - { name: 'php5-fpm', cond: "{{ nginx_php56 }}" }

View File

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