From e3f897d9031183c4493842370699d7ea93574a4d Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 1 Aug 2016 17:22:51 +0200 Subject: [PATCH] library/roles/php-fpm: Some changes needed to make the PPA working. library/roles/drupal-org: Add some modules. --- drupal-org/defaults/main.yml | 15 ++++++++++----- drupal-org/tasks/main.yml | 16 ++++++++-------- php-fpm/defaults/main.yml | 9 ++++++--- php-fpm/handlers/main.yml | 4 ++-- php-fpm/tasks/main.yml | 4 ++-- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drupal-org/defaults/main.yml b/drupal-org/defaults/main.yml index a60cf50..50413cf 100644 --- a/drupal-org/defaults/main.yml +++ b/drupal-org/defaults/main.yml @@ -9,11 +9,16 @@ drupal_download_dir: /srv/drupal drupal_install_dir: /var/www drupal_php_prereq: - - php5-json - - php5-intl - - php5-cli - - php5-mysqlnd - - php5-gd + - 'php{{ php_version }}-json' + - 'php{{ php_version }}-intl' + - 'php{{ php_version }}-cli' + - 'php{{ php_version }}-mysqlnd' + - 'php{{ php_version }}-gd' + - 'php{{ php_version }}-xml' + - 'php{{ php_version }}-json' + - 'php{{ php_version }}-curl' + - 'php{{ php_version }}-mbstring' + - php-ssh2 - php-apc - php-pear - php-date diff --git a/drupal-org/tasks/main.yml b/drupal-org/tasks/main.yml index a97c27a..520cfb7 100644 --- a/drupal-org/tasks/main.yml +++ b/drupal-org/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Install the drupal php prerequisites apt: name={{ item }} state=latest update_cache=yes cache_valid_time=3600 - with_items: drupal_php_prereq + with_items: '{{ drupal_php_prereq }}' tags: drupal - name: Ensure that the download and install dirs exist @@ -31,26 +31,26 @@ command: cp -a {{ drupal_download_dir }}/{{ drupal_dist_name }} {{ drupal_install_dir }}/{{ item.virthost }} args: creates: '{{ drupal_install_dir }}/{{ item.virthost }}/index.php' - with_items: phpfpm_pools + with_items: '{{ phpfpm_pools }}' when: ( drupal_download | changed ) register: unpack_drupal tags: drupal - name: Create the default settings file - command: cp {{ drupal_install_dir }}/{{ item.virthost }}/sites/default/default.settings.php {{ drupal_install_dir }}/{{ item.virthost }}sites/default/settings.php + command: cp {{ drupal_install_dir }}/{{ item.virthost }}/sites/default/default.settings.php {{ drupal_install_dir }}/{{ item.virthost }}/sites/default/settings.php args: creates: '{{ drupal_install_dir }}/{{ item.virthost }}/sites/default/settings.php' - with_items: phpfpm_pools + with_items: '{{ phpfpm_pools }}' when: - ( unpack_drupal | changed ) - '{{ drupal_major_ver }} >= 8' tags: drupal - name: Create the default services file - command: cp {{ drupal_install_dir }}/{{ item.virthost }}/sites/default/default.services.yml {{ drupal_install_dir }}/{{ item.virthost }}sites/default/services.yml + command: cp {{ drupal_install_dir }}/{{ item.virthost }}/sites/default/default.services.yml {{ drupal_install_dir }}/{{ item.virthost }}/sites/default/services.yml args: creates: '{{ drupal_install_dir }}/{{ item.virthost }}/sites/default/services.yml' - with_items: phpfpm_pools + with_items: '{{ phpfpm_pools }}' when: - ( unpack_drupal | changed ) - '{{ drupal_major_ver }} >= 8' @@ -58,13 +58,13 @@ - name: Create the files directory file: dest={{ drupal_install_dir }}/{{ item.virthost }}/sites/default/files owner={{ item.user }} group={{ item.group }} mode=0770 state=directory - with_items: phpfpm_pools + with_items: '{{ phpfpm_pools }}' when: ( unpack_drupal | changed ) tags: drupal - name: Set the correct ownership of the drupal files file: dest={{ drupal_install_dir }}/{{ item.virthost }} owner={{ item.user }} group={{ item.group }} recurse=yes state=directory - with_items: phpfpm_pools + with_items: '{{ phpfpm_pools }}' when: ( unpack_drupal | changed ) tags: drupal diff --git a/php-fpm/defaults/main.yml b/php-fpm/defaults/main.yml index 74e6640..46bdaf2 100644 --- a/php-fpm/defaults/main.yml +++ b/php-fpm/defaults/main.yml @@ -9,14 +9,17 @@ php_from_ppa: False php_ppa: ppa:ondrej/php php_version: 5 -phpfpm_base_dir: /etc/php5/fpm +phpfpm_base_dir: '/etc/php{{ php_version }}/fpm' +# Change to when using the PPA +# phpfpm_base_dir: '/etc/php/{{ php_version }}/fpm' + php_fpm_packages: - 'php{{ php_version }}-fpm' # Main confign file settings # It can be 'syslog' phpfpm_logdir: /var/log/php-fpm -phpfpm_error_logfile: /var/log/php5-fpm.log +phpfpm_error_logfile: '/var/log/php{{ php_version }}-fpm.log' phpfpm_syslog_facility: daemon phpfpm_syslog_ident: php-fpm phpfpm_log_level: notice @@ -58,7 +61,7 @@ phpfpm_default_rlimit_files: "1024" phpfpm_default_extensions: ".php" phpfpm_default_context: '/' phpfpm_default_session_handler: 'files' -phpfpm_default_session_prefix: '/var/lib/php5' +phpfpm_default_session_prefix: '/var/lib/php' phpfpm_session_prefix: '{{ phpfpm_default_session_prefix }}' phpfpm_default_define_custom_variables: False diff --git a/php-fpm/handlers/main.yml b/php-fpm/handlers/main.yml index c640cb3..dc9b0be 100644 --- a/php-fpm/handlers/main.yml +++ b/php-fpm/handlers/main.yml @@ -1,8 +1,8 @@ --- - name: Reload php-fpm - service: name=php5-fpm state=reloaded + service: name=php{{ php_version }}-fpm state=reloaded when: phpfpm_service_enabled - name: Restart php-fpm - service: name=php5-fpm state=restarted + service: name=php{{ php_version }}-fpm state=restarted when: phpfpm_service_enabled diff --git a/php-fpm/tasks/main.yml b/php-fpm/tasks/main.yml index 7fe7f4a..95513f5 100644 --- a/php-fpm/tasks/main.yml +++ b/php-fpm/tasks/main.yml @@ -68,12 +68,12 @@ tags: [ 'php', 'fpm_conf', 'fpm_pool', 'fpm_pool_conf' ] - name: Ensure that the php-fpm service is started and enabled - service: name=php5-fpm state=started enabled=yes + service: name=php{{ php_version }}-fpm state=started enabled=yes when: phpfpm_service_enabled tags: php - name: Ensure that the php-fpm service is stopped and disabled - service: name=php5-fpm state=stopped enabled=no + service: name=php{{ php_version }}-fpm state=stopped enabled=no when: not phpfpm_service_enabled tags: php