darexsu.php

Ansibleロール PHP 7.x, 8.x

CI MoleculeAnsibleロール

プラットフォーム

テスト リポジトリ: ディストリビューション リポジトリ: サードパーティ
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

インストール

ansible-galaxy install darexsu.php --force

マージ動作

ディクショナリの置き換えまたはマージ(ansible.cfgに"hash_behaviour=replace"を設定):

# 置き換え             # マージ
---                   ---
  vars:                 vars:
    dict:                 merge:
      a: "value"            dict: 
      b: "value"              a: "value" 
                              b: "value"

# マージの動作は?:
あなたのvars [host_vars]  -->  デフォルトvars [現在のロール] --> デフォルトvars [ロールを含む]
  
  dict:          dict:              dict:
    a: "1" -->     a: "1"    -->      a: "1"
                   b: "2"    -->      b: "2"
                                      c: "3"
    
インストールと設定: PHP(マージ版)
---
- hosts: all
  become: true

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
      # PHP -> インストール
      php_install:
        enabled: true
        modules: [common, fpm]
      # PHP -> 設定 -> php.ini
      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 -> 設定 -> php.fpm
      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: darexsu.phpロールを含む
      include_role:
        name: darexsu.php
インストール: PHP, リポジトリ: ディストリビューション(マージ版)
---
- hosts: all
  become: true

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
        repo: "distribution"
      # PHP -> インストール
      php_install:
        enabled: true
        modules: [common, fpm]

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
インストール: PHP, リポジトリ: サードパーティ(マージ版)
---
- hosts: all
  become: true

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "8.0"
        repo: "third_party"

      # PHP -> インストール
      php_install:
        enabled: true
        modules: [common, fpm]

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
インストール: PHPモジュール(マージ版)
---
- hosts: all
  become: true

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
        repo: "third_party"
      # PHP -> インストール
      php_install:
        enabled: true
      # PHP -> インストール -> カスタムモジュールをインストール
        modules: [common, fpm, gd]

  tasks:
    - name: darexsu.phpロールを含む
      include_role:
        name: darexsu.php
設定: php.ini(マージ版)
---
- hosts: all
  become: true

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
        repo: "third_party"
      # PHP -> 設定 -> php.ini
      php_ini:
        enabled: true
        data:
          php:
            engine: "オン"
            short_open_tag: "オフ"
            precision: "14"
            output_buffering: "4096"
            zlib_output_compression: "オフ"
            implicit_flush: "オフ"
       #    ...

  tasks:
    - name: darexsu.phpロールを含む
      include_role:
        name: darexsu.php
設定: php-fpm TCP/IPソケット(マージ版)
---
- hosts: all
  become: yes

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
        repo: "third_party"
      # PHP -> 設定 -> php-fpmプール
      php_fpm:
        www_conf:
          enabled: true
          file: "www.conf"
          state: "present"
          src: "php_fpm.j2"
          backup: true          
          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"
      # PHP -> 設定 -> php-fpmプール -> TCP/IPソケットを有効にする   
            tcp_ip_socket:
              enabled: true
              listen: "127.0.0.1:9000"
      # PHP -> 設定 -> php-fpmプール -> UNIXソケットを無効にする
            unix_socket:
              enabled: false
              file: "php{{ php.version }}-fpm.sock"
              user: "www-data"
              group: "www-data"  

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
設定: php-fpm UNIXソケット(マージ版)
---
- hosts: all
  become: yes

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
        repo: "third_party"
      # PHP -> 設定 -> php-fpmプール
      php_fpm:
        www_conf:
          enabled: true
          file: "www.conf"
          state: "present"
          src: "php_fpm.j2"
          backup: true         
          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"
      # PHP -> 設定 -> php-fpmプール -> TCP/IPソケットを無効にする       
            tcp_ip_socket:
              enabled: false
              listen: "127.0.0.1:9000"
      # PHP -> 設定 -> php-fpmプール -> UNIXソケットを有効にする
            unix_socket:
              enabled: true
              file: "php{{ php.version }}-fpm.sock"
              user: "www-data"
              group: "www-data"  

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
設定: 複数の設定を追加(マージ版)
---
- hosts: all
  become: yes

  vars:
    merge:
      # PHP
      php:
        enabled: true
        version: "7.4"
        repo: "third_party"
      # PHP -> 設定 -> php-fpmプール
      php_fpm:
      # PHP -> 設定 -> php.fpmプール -> www.confを削除  
        www_conf:
          enabled: true
          state: "absent"
      # PHP -> 設定 -> php.fpmプール -> new.confを追加
        first_conf:
          enabled: true
          file: "first.conf"
          state: "present"
          src: "php_fpm.j2"
          backup: true         
          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"      
            tcp_ip_socket:
              enabled: false
              listen: "127.0.0.1:9000"
            unix_socket:
              enabled: true
              file: "php{{ php.version }}-first-fpm.sock"
              user: "www-data"
              group: "www-data"
      # PHP -> 設定 -> php.fpmプール -> second.confを追加
        second_conf:
          enabled: true
          file: "second.conf"
          state: "present"
          src: "php_fpm.j2"
          backup: true         
          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"      
            tcp_ip_socket:
              enabled: false
              listen: "127.0.0.1:9000"
            unix_socket:
              enabled: true
              file: "php{{ php.version }}-second-fpm.sock"
              user: "www-data"
              group: "www-data"

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
インストールと設定: PHP(フル版)
---
- hosts: all
  become: true

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "third_party"
      service:
        enabled: true
        state: "started"
    # PHP -> インストール
    php_install:
      enabled: true
      modules: [common, fpm]
    # PHP -> 設定 -> php.ini
    php_ini:
      enabled: true
      file: "php.ini"
      src: "php_ini.j2"
      backup: false
      data:
        php:
          engine: "オン"
          short_open_tag: "オフ"
          precision: "14"
          output_buffering: "4096"
          zlib_output_compression: "オフ"
          implicit_flush: "オフ"
          unserialize_callback_func: ""
          serialize_precision: "-1"
          disable_functions: ""
          disable_classes: ""
          zend_enable_gc: ""
          zend_exception_ignore_args: "オン"
          zend_exception_string_param_max_len: "0"
          expose_php: "オン"
          max_execution_time: "30"
          max_input_time: "60"
          memory_limit: "128M"
          error_reporting: "E_ALL & ~E_DEPRECATED & ~E_STRICT"
          display_errors: "オフ"
          display_startup_errors: "オフ"
          log_errors: "オン"
          log_errors_max_len: "1024"
          ignore_repeated_errors: "オフ"
          ignore_repeated_source: "オフ"
          report_memleaks: "オン"
          variables_order: "GPCS"
          request_order: "GP"
          register_argc_argv: "オフ"
          auto_globals_jit: "オン"
          post_max_size: "8M"
          auto_prepend_file: ""
          auto_append_file: ""
          default_mimetype: "text/html"
          default_charset: "UTF-8"
          doc_root: ""
          user_dir: ""
          enable_dl: "オフ"
          file_uploads: "オン"
          upload_max_filesize: "2M"
          max_file_uploads: "20"
          allow_url_fopen: "オン"
          allow_url_include: "オフ"
          default_socket_timeout: "60"
    # PHP -> 設定 -> php.fpm
    php_fpm:
      www_conf:
        enabled: true
        file: "www.conf"
        state: "present"
        src: "php_fpm.j2"
        backup: false
        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"
          tcp_ip_socket:
            enabled: false
            listen: "127.0.0.1:9000"
          unix_socket:
            enabled: true
            file: "php{{ php.version }}-fpm.sock"
            user: "www-data"
            group: "www-data"

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
インストール: PHP, リポジトリ: ディストリビューション(フル版)
---
- hosts: all
  become: true

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "distribution"
      service:
        enabled: true
        state: "started"
    # PHP -> インストール
    php_install:
      enabled: true
      modules: [common, fpm]

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
インストール: PHP, リポジトリ: サードパーティ(フル版)
---
- hosts: all
  become: true

  vars:
    # PHP
    php:
      enabled: true
      version: "8.0"
      repo: "third_party"
      service:
        enabled: true
        state: "started"
    # PHP -> インストール
    php_install:
      enabled: true
      modules: [common, fpm]

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
インストール: PHPモジュール(フル版)
---
- hosts: all
  become: true

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "third_party"
      service:
        enabled: true
        state: "started"
    # PHP -> インストール
    php_install:
      enabled: true
    # PHP -> インストール -> カスタムモジュールをインストール
      modules: [common, fpm, gd]

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php 
設定: php.ini(フル版)
---
- hosts: all
  become: true

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "third_party"
      service:
        enabled: true
        state: "started"
    # PHP -> 設定 -> php.ini
    php_ini:
      enabled: true
      file: "php.ini"
      src: "php_ini.j2"
      backup: false
      data:
        php:
          engine: "オン"
          short_open_tag: "オフ"
          precision: "14"
          output_buffering: "4096"
          zlib_output_compression: "オフ"
          implicit_flush: "オフ"
          unserialize_callback_func: ""
          serialize_precision: "-1"
          disable_functions: ""
          disable_classes: ""
          zend_enable_gc: ""
          zend_exception_ignore_args: "オン"
          zend_exception_string_param_max_len: "0"
          expose_php: "オン"
          max_execution_time: "30"
          max_input_time: "60"
          memory_limit: "128M"
          error_reporting: "E_ALL & ~E_DEPRECATED & ~E_STRICT"
          display_errors: "オフ"
          display_startup_errors: "オフ"
          log_errors: "オン"
          log_errors_max_len: "1024"
          ignore_repeated_errors: "オフ"
          ignore_repeated_source: "オフ"
          report_memleaks: "オン"
          variables_order: "GPCS"
          request_order: "GP"
          register_argc_argv: "オフ"
          auto_globals_jit: "オン"
          post_max_size: "8M"
          auto_prepend_file: ""
          auto_append_file: ""
          default_mimetype: "text/html"
          default_charset: "UTF-8"

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
設定: php-fpm TCP/IPソケット(フル版)
---
- hosts: all
  become: yes

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "third_party"
    # PHP -> 設定 -> php-fpmプール
    php_fpm:
      www_conf:
        enabled: true
        file: "www.conf"
        state: "present"
        src: "php_fpm.j2"
        backup: true          
        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"
    # PHP -> 設定 -> php-fpmプール -> TCP/IPソケットを有効にする   
          tcp_ip_socket:
            enabled: true
            listen: "127.0.0.1:9000"
    # PHP -> 設定 -> php-fpmプール -> UNIXソケットを無効にする
          unix_socket:
            enabled: false
            file: "php{{ php.version }}-fpm.sock"
            user: "www-data"
            group: "www-data"  

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
設定: php-fpm UNIXソケット(フル版)
---
- hosts: all
  become: yes

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "third_party"
    # PHP -> 設定 -> php-fpmプール
    php_fpm:
      www_conf:
        enabled: true
        file: "www.conf"
        state: "present"
        src: "php_fpm.j2"
        backup: true         
        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"
    # PHP -> 設定 -> php-fpmプール -> TCP/IPソケットを無効にする       
          tcp_ip_socket:
            enabled: false
            listen: "127.0.0.1:9000"
    # PHP -> 設定 -> php-fpmプール -> UNIXソケットを有効にする
          unix_socket:
            enabled: true
            file: "php{{ php.version }}-fpm.sock"
            user: "www-data"
            group: "www-data"  

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
設定: 複数の設定を追加(フル版)
---
- hosts: all
  become: yes

  vars:
    # PHP
    php:
      enabled: true
      version: "7.4"
      repo: "third_party"
    # PHP -> 設定 -> php-fpmプール
    php_fpm:
    # PHP -> 設定 -> php.fpmプール -> www.confを削除  
      www_conf:
        enabled: true
        state: "absent"
    # PHP -> 設定 -> php.fpmプール -> new.confを追加
      first_conf:
        enabled: true
        file: "first.conf"
        state: "present"
        src: "php_fpm.j2"
        backup: true         
        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"      
          tcp_ip_socket:
            enabled: false
            listen: "127.0.0.1:9000"
          unix_socket:
            enabled: true
            file: "php{{ php.version }}-first-fpm.sock"
            user: "www-data"
            group: "www-data"
    # PHP -> 設定 -> php.fpmプール -> second.confを追加
      second_conf:
        enabled: true
        file: "second.conf"
        state: "present"
        src: "php_fpm.j2"
        backup: true         
        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"      
          tcp_ip_socket:
            enabled: false
            listen: "127.0.0.1:9000"
          unix_socket:
            enabled: true
            file: "php{{ php.version }}-second-fpm.sock"
            user: "www-data"
            group: "www-data"

  tasks:
    - name: darexsu.phpロールを含む
      include_role: 
        name: darexsu.php
プロジェクトについて

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

インストール
ansible-galaxy install darexsu.php
ライセンス
mit
ダウンロード
2.9k
所有者