darexsu.php

Ansible Role for PHP 7.x, 8.x

CI MoleculeAnsible Role

Platforms

Testing Repo: Distribution Repo: Third Party
Debian 11 PHP 7.4 Sury
Debian 10 PHP 7.3 Sury
Ubuntu 20.04 PHP 7.4 ppa:andrej
Ubuntu 18.04 PHP 7.2 ppa:andrej
Oracle Linux 8 PHP 7.2-7.4 Remi
Rocky Linux 8 PHP 7.2-7.4 Remi

Install

To install the Ansible role, use this command:

ansible-galaxy install darexsu.php --force

Merge Behavior

You can either replace or merge dictionaries (use "hash_behaviour=replace" in ansible.cfg):

# Replace             # Merge
---                   ---
  vars:                 vars:
    dict:                 merge:
      a: "value"            dict: 
      b: "value"              a: "value" 
                              b: "value"

# How does merge work?:
Your vars [host_vars]  -->  default vars [current role] --> default vars [include role]

  dict:          dict:              dict:
    a: "1" -->     a: "1"    -->      a: "1"
                   b: "2"    -->      b: "2"
                                      c: "3"
Install and Configure: PHP (Merge Version)
---
- hosts: all
  become: true

  vars:
    merge:
      php:
        enabled: true
        version: "7.4"
      php_install:
        enabled: true
        modules: [common, fpm]
      php_ini:
        enabled: true
        file: "php.ini"
        src: "php_ini.j2"
        backup: false
        data:
          php:
            max_execution_time: "30"
            max_input_time: "60"
            memory_limit: "128M"
            upload_max_filesize: "2M"
      php_fpm:
        www_conf:
          enabled: true
          file: "www.conf"
          state: "present"
          data:
            webserver_user: "www-data"
            webserver_group: "www-data"
            pm: "dynamic"
            pm_max_children: "10"
            pm_start_servers: "5"
            pm_min_spare_servers: "5"
            pm_max_spare_servers: "5"
            pm_max_requests: "500"
            unix_socket:
              enabled: true
              file: "php{{ php.version }}-fpm.sock"
              user: "www-data"
              group: "www-data"

  tasks:
    - name: Include role darexsu.php
      include_role:
        name: darexsu.php

The above structure is repeated for the other configurations, such as installing PHP from a specific repository, configuring php.ini, and handling PHP-FPM. Each example follows the same YAML format with the corresponding details.

Summary

This role helps you install and configure different PHP versions and their modules on multiple Linux distributions using Ansible, ensuring ease of management and deployment.

Informazioni sul progetto

install and configure php 7.x, php 8.x.

Installa
ansible-galaxy install darexsu.php
Licenza
mit
Download
2.9k
Proprietario