Code Monkey home page Code Monkey logo

ansible-role-php's Introduction

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Php Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with the setup and config of PHP.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

This role is made to work with the sury or dotdeb php debian repositories. Please use the manala.apt role to handle them properly.

manala_apt_preferences:
  - php@sury_php
  # - php@dotdeb

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.php

Using ansible galaxy requirements file:

- src: manala.php

Role Handlers

Name Type Description
php fpm restart Service Check php fpm configuration and restart service if ok
php blackfire agent restart Service Restart php blackfire agent service

Role Variables

Name Default Type Description
manala_php_version ~ String,Integer,Float Php version
manala_php_sapis_exclusive false Boolean Should the SAPIs list be exclusive ?
manala_php_sapis ~ Array A list of PHP SAPIs
manala_php_sapis_default ['cli', 'fpm'] Array Default list of PHP SAPIs
manala_php_extensions_exclusive false Boolean Should the extensions list be exclusive ?
manala_php_extensions [] Array A list of PHP extensions
manala_php_configs_template 'configs/empty.j2' String Configs base template path
manala_php_configs_exclusive: false Boolean Should configs files be exclusive ?
manala_php_configs [] Array Configs files
manala_php_cli_configs [] Array Configs files (cli SAPI only)
manala_php_fpm_configs [] Array Configs files (fpm SAPI only)
manala_php_cgi_configs [] Array Configs files (cgi SAPI only)
manala_php_phpdbg_configs [] Array Configs files (phpdbg SAPI only)
manala_php_fpm_pools_template 'fpm_pools/empty.j2' String Fpm pools base template path
manala_php_fpm_pools_exclusive false Boolean Should fpm pools files be exclusive ?
manala_php_fpm_pools [] Array Fpm pools files
manala_php_blackfire false Boolean Install blackfire
manala_php_blackfire_agent_config_file '/etc/blackfire/agent' String Blackfire agent config file path
manala_php_blackfire_agent_config_template 'blackfire/agent/default.j2' String Blackfire agent config base template path
manala_php_blackfire_agent_config [] Array Blackfire agent config
manala_php_blackfire_client_config_file '~/.blackfire.ini' String Blackfire client config file path
manala_php_blackfire_client_config_template 'blackfire/client/default.j2' String Blackfire client config base template path
manala_php_blackfire_client_config [] Array Blackfire client config
manala_php_applications_dir '/usr/local/bin' String Applications directory path
manala_php_applications [] Array A list of php applications

Configuration example

Version matrix

Version Distribution Repository manala_apt_preferences manala_php_version
5.6 Stretch Sury php@sury_php 5.6
5.6 Buster Sury php@sury_php 5.6
7.0 Jessie Dotdeb php@dotdeb 7.0
7.0 Stretch Sury php@sury_php 7.0
7.0 Buster Sury php@sury_php 7.0
7.1 Stretch Sury php@sury_php 7.1
7.1 Buster Sury php@sury_php 7.1
7.2 Stretch Sury php@sury_php 7.2
7.2 Buster Sury php@sury_php 7.2
7.3 Stretch Sury php@sury_php 7.3
7.3 Buster Sury php@sury_php 7.3
7.4 Stretch Sury php@sury_php 7.4
7.4 Buster Sury php@sury_php 7.4
8.0 Stretch Sury php@sury_php 8.0
8.0 Buster Sury php@sury_php 8.0

Sapis

manala_php_sapis_exclusive: true # Ensure other sapis are automatically absents
manala_php_sapis:
  - cli
  - fpm
  # Ensure sapi is absent
  - sapi: cgi
    state: absent
  # Ignore sapi
  - sapi: phpdbg
    state: ignore

Extensions

manala_php_extensions_exclusive: true # Ensure other extensions are automatically absents
manala_php_extensions:
  - intl
  - gd
  - extension: xdebug
    enabled: false # Ensure extension will be installed *but* disabled
  # Ensure extension is absent
  - extension: gd
    state: absent
  # Ignore extension
  - extension: xml
    state: ignore

Configs

A state (present|absent) can be provided.

All sapis

manala_php_configs_exclusive: true # Ensure other configs are automatically absents
manala_php_configs:
  # Template based
  - file: foo_template.ini
    template: configs/default.dev.j2
  # Config based
  - file: foo.ini
    config:
      date.timezone: UTC
  # Dict's array config based (deprecated)
  - file: foo.ini
    config:
      - date.timezone: UTC
  # Raw content based
  - file: foo_content.ini
    config: |
      memory_limit = 512M
  # Ensure config is absent
  - file: absent.ini
    state: absent # "present" by default
  # Ignore config
  - file: ignore.ini
    state: ignore
  # Flatten configs
  - "{{ my_custom_configs_array }}"

Sapis specific

# Fpm
manala_php_fpm_configs:
  - file: app.ini
    config:
      max_input_time: 60
      output_buffering: 4096
      expose_php: true
      memory_limit: 512M

# Cli
manala_php_cli_configs:
  - file: app.ini
    config:
      max_input_time: -1
      output_buffering: 4096
      expose_php: false
      memory_limit: 2G

Fpm pools

manala_php_fpm_pools:
  - file: www.conf
    config:
      www:
        pm.max_children: 5
        pm.start_servers: 2
        pm.min_spare_servers: 1
        pm.max_spare_servers: 3
        env:
          FOO: bar
          APP_ENV: prod
        php_flag:
          display_errors: true
  # Dict's array based (deprecated)
  - file: www.conf
    config:
      - www:
        - pm.max_children: 5
        - pm.start_servers: 2
        - pm.min_spare_servers: 1
        - pm.max_spare_servers: 3
        - env:
            FOO: bar
            APP_ENV: prod
        - php_flag[display_errors]: true
  # Content based
  - file: content.conf
    config: |
      [www]
      user = foo
      group = foo
  # Ensure pool is absent
  - file: absent.conf
    state: absent # "present" by default
  # Ignore pool
  - file: ignore.conf
    state: ignore
  # Flatten configs
  - "{{ my_custom_pools_array }}"

Applications:

Installation of specific php applications

manala_php_applications:
  - [email protected]
List of available applications:
  • phpcs
  • phpcbf
  • openl10n
  • phpunit
  • php-cs-fixer
  • couscous
  • security-checker
  • deptrac
  • wp-cli
  • drush

Blackfire

manala_php_blackfire: true

manala_php_blackfire_agent_config:
  server-id: your-server-id
  server-token: your-token-id

manala_php_blackfire_client_config:
  client-id: your-client-id
  client-token: your-client-token

Example playbook

- hosts: servers
  roles:
    - role: manala.php

Licence

MIT

Author information

Manala (http://www.manala.io/)

ansible-role-php's People

Contributors

greedybro avatar kocal avatar nervo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.