php: Teile Tasks in einzelne Dateien auf

This commit is contained in:
phil 2022-06-09 15:15:49 +02:00
parent d81fe5f763
commit 4a7f8f212c
3 changed files with 46 additions and 37 deletions

View file

@ -1,45 +1,12 @@
--- ---
- name: "Sammle Package Fakten"
package_facts:
manager: apt
- name: "Installiere Pakete"
apt:
pkg:
- php
- php-apcu
- php-fpm
- php-zip
- name: "Ermmittle PHP-Version" - name: "Ermmittle PHP-Version"
shell: shell:
cmd: php -v | grep -Po '(?<=PHP )([0-9.]{3})' cmd: php -v | grep -Po '(?<=PHP )([0-9.]{3})'
register: php_version register: php_version
changed_when: false changed_when: false
- name: "Kopiere angepasste Konfiguration" - import_tasks: packages.yml
template: tags: packages
src: sao.ini.j2
dest: "/etc/php/{{ php_version.stdout }}/mods-available/sao.ini"
- name: "Verlinke cli Konfiguration" - import_tasks: php.yml
file: tags: php
src: "/etc/php/{{ php_version.stdout }}/mods-available/sao.ini"
dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-sao.ini"
state: link
- name: "Verlinke Apache Konfiguration"
file:
src: "/etc/php/{{ php_version.stdout }}/mods-available/sao.ini"
dest: "/etc/php/{{ php_version.stdout }}/apache2/conf.d/30-sao.ini"
state: link
when: "'libapache2-mod-php{{ php_version.stdout }}' in ansible_facts.packages"
notify: reload apache2
- name: "Verlinke FPM-Konfiguration"
file:
src: "/etc/php/{{ php_version.stdout }}/mods-available/sao.ini"
dest: "/etc/php/{{ php_version.stdout }}/fpm/conf.d/30-sao.ini"
state: link
when: "'php-fpm' in ansible_facts.packages"
notify: reload php-fpm

12
tasks/packages.yml Normal file
View file

@ -0,0 +1,12 @@
---
- name: "packages | Sammle Package Fakten"
package_facts:
manager: apt
- name: "packages | Installiere Pakete"
apt:
pkg:
- php
- php-apcu
- php-fpm
- php-zip

30
tasks/php.yml Normal file
View file

@ -0,0 +1,30 @@
---
- name: "php | Kopiere angepasste Konfigurationsdateien"
template:
src: "{{ item }}.j2"
dest: "/etc/php/{{ php_version.stdout }}/mods-available/{{ item }}"
loop:
- sao.ini
- sao-fpm.ini
- name: "php | Verlinke Apache Konfiguration"
file:
src: "/etc/php/{{ php_version.stdout }}/mods-available/sao.ini"
dest: "/etc/php/{{ php_version.stdout }}/apache2/conf.d/30-sao.ini"
state: link
when: "'libapache2-mod-php{{ php_version.stdout }}' in ansible_facts.packages"
notify: reload apache2
- name: "php | Verlinke cli Konfiguration"
file:
src: "/etc/php/{{ php_version.stdout }}/mods-available/sao.ini"
dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-sao.ini"
state: link
- name: "php | Verlinke FPM-Konfiguration"
file:
src: "/etc/php/{{ php_version.stdout }}/mods-available/sao-fpm.ini"
dest: "/etc/php/{{ php_version.stdout }}/fpm/conf.d/30-sao-fpm.ini"
state: link
when: "'php-fpm' in ansible_facts.packages"
notify: reload php-fpm