Modernize

* Fix lint errors due to ansible-lint latest version
* Drop debian stretch support
This commit is contained in:
Emilien M
2022-10-06 14:47:06 +02:00
committed by GitHub
parent 4aef107c1a
commit e9e74e2db6
12 changed files with 62 additions and 58 deletions

View File

@@ -1,6 +1,7 @@
---
- hosts: all
name: Test all
vars:
vhost: 'test.local'
php_extra_packages:
@@ -46,24 +47,24 @@
- name: TEMPLATE | Nginx site config
ansible.builtin.template:
src: "templates/nginx.conf.j2"
dest: "{{ __nginx_conf }}"
dest: "{{ __nginx_conf }}"
mode: 0644
owner: root
group: root
notify: reload nginx
notify: Reload nginx
- name: COMMAND | Fix nginx config
ansible.builtin.command: "cp {{ __nginx_conf | dirname }}/fastcgi_params {{ __nginx_conf | dirname }}/fastcgi.conf"
args:
creates: "{{ __nginx_conf | dirname }}/fastcgi.conf"
notify: reload nginx
notify: Reload nginx
- name: LINEINFILE | Fix nginx config (second step)
ansible.builtin.lineinfile:
regexp: '^fastcgi_param\s+SCRIPT_FILENAME'
line: "fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;"
dest: "{{ __nginx_conf | dirname }}/fastcgi.conf"
notify: reload nginx
notify: Reload nginx
- name: SERVICE | Ensure nginx is started
ansible.builtin.service:
@@ -71,7 +72,9 @@
state: started
when: ansible_virtualization_type != 'docker'
- block:
- name: Start nginx if testing with Docker
when: ansible_virtualization_type == 'docker'
block:
- name: COMMAND | Docker nginx status
ansible.builtin.command: service nginx status
@@ -87,21 +90,19 @@
warn: false
when: ngs.stdout.find('nginx is not running') != -1
when: ansible_virtualization_type == 'docker'
handlers:
- name: reload nginx
- name: Reload nginx
ansible.builtin.service:
name: nginx
state: reloaded
notify: docker reload nginx
notify: Docker reload nginx
- name: docker reload nginx
- name: Docker reload nginx
ansible.builtin.command: service nginx reload
args:
warn: false
notify: docker reload nginx
notify: Docker reload nginx
when: ansible_virtualization_type == 'docker'
roles:
@@ -168,7 +169,9 @@
url: "http://localhost{{ php_fpm_poold.0.status_path }}"
when: php_fpm_poold.0.status_path is defined
- block:
- name: Debian extra checks
when: ansible_os_family == 'Debian'
block:
- name: SHELL | Check if we installed multiple PHP versions
ansible.builtin.shell: set -o pipefail && (dpkg -l | grep 'php[[:digit:]].*common' | wc -l)
@@ -183,5 +186,3 @@
ansible.builtin.fail:
msg: "Multiple PHP versions detected"
when: check_multiple_php.stdout != '1'
when: ansible_os_family == 'Debian'