diff --git a/tasks/msodbc.yml b/tasks/msodbc.yml index fe7ad3bdf85882ee14f7228d50603df131de5382..84bfc97e2262d3ac3e058b7caa12a9d0333e49a3 100644 --- a/tasks/msodbc.yml +++ b/tasks/msodbc.yml @@ -33,7 +33,7 @@ - mssql-tools - unixodbc-dev notify: - - "Apache | Restart Apache" + - "Restart Apache" - name: PHP | Install PECL packages shell: pecl install --soft {{ item }} @@ -52,7 +52,7 @@ - sqlsrv - pdo_sqlsrv notify: - - "Apache | Restart Apache" + - "Restart Apache" - name: Enable extensions shell: phpenmod {{ item }} @@ -60,4 +60,4 @@ - sqlsrv - pdo_sqlsrv notify: - - "Apache | Restart Apache" + - "Restart Apache" diff --git a/tasks/php.yml b/tasks/php.yml index 9896846ff62f7b5468ef5c1bb44b1079ce9a9137..f0807acbbe99564511de0dddc630e214e894b42b 100644 --- a/tasks/php.yml +++ b/tasks/php.yml @@ -1,110 +1,110 @@ --- # file: roles/php/tasks/php.yml -- name: PHP | Apt Repository +- name: Apt Repository apt_repository: - repo='{{ item }}' - state='present' - mode='644' + repo: '{{ item }}' + state: present + mode: 0644 with_items: '{{ php_repositories }}' -- name: PHP | Install required packages. +- name: Install required packages. apt: - pkg={{ php_packages }} - state=present - force=yes + pkg: '{{ php_packages }}' + state: present + force: yes notify: - - "Apache | Restart Apache" + - "Restart Apache" -- name: PHP | Hold em all - shell: dpkg --get-selections | grep ^php | sed s/install/hold/g | sudo dpkg --set-selections +- name: Hold em all + shell: dpkg --get-selections | grep ^sed s/install/hold/g | sudo dpkg --set-selections when: php_hold_version -- name: PHP | Install PECL packages +- name: Install PECL packages shell: pecl install --soft imagick-3.3.0 when: php_version_main|default('7') != '7' - ignore_errors: true + ignore_errors: yes # NOTE: If oauth is already installed and we install a new PHP 7 version then this fails and we need --force as well -- name: PHP | Install PECL packages +- name: Install PECL packages shell: pecl install --soft --force oauth when: php_version_main|default('7') == '7' - ignore_errors: true + ignore_errors: yes -- name: PHP | Ensure Apache config directory +- name: Ensure Apache config directory file: - dest=/etc/{{ php_base_dir }}/apache2 - state=directory - owner=root - group=root - mode='755' + dest: /etc/{{ php_base_dir }}/apache2 + state: directory + owner: root + group: root + mode: 0755 -- name: PHP | Configuration file, php.ini +- name: Configuration file, php.ini template: - src=etc-php5-apache2-php.ini - dest=/etc/{{ php_base_dir }}/apache2/php.ini - owner=root - group=root - mode='644' + src: etc-php5-apache2-php.ini + dest: /etc/{{ php_base_dir }}/apache2/php.ini + owner: root + group: root + mode: 0644 notify: - - "Apache | Restart Apache" + - "Restart Apache" - import_tasks: php53.yml when: php_version|default('5.5') == '5.3' -- name: PHP | Configuration file, fcgid.conf +- name: Configuration file, fcgid.conf template: - src=fcgid.conf - dest=/etc/apache2/mods-available/fcgid.conf - owner=root - group=root - mode='644' + src: fcgid.conf + dest: /etc/apache2/mods-available/fcgid.conf + owner: root + group: root + mode: 0644 notify: - - "Apache | Restart Apache" + - "Restart Apache" -- name: PHP | Configuration files +- name: Configuration files template: - src=etc-php5-conf-d-{{ item }}.ini - dest=/etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini - owner=root - group=root - mode='644' + src: etc-php5-conf-d-{{ item }}.ini + dest: /etc/{{ php_base_dir }}/{{ php_conf_dir }}/{{ item }}.ini + owner: root + group: root + mode: 0644 with_items: - opcache notify: - - "Apache | Restart Apache" + - "Restart Apache" -- name: PHP | Create extra directory for browscap +- name: Create extra directory for browscap file: - dest=/etc/{{ php_base_dir }}/apache2/extra - state=directory - owner=root - group=root + dest: /etc/{{ php_base_dir }}/apache2/extra + state: directory + owner: root + group: root when: php_browscap -- name: PHP | browscap.ini +- name: browscap.ini copy: - src=browscap.ini - dest=/etc/{{ php_base_dir }}/apache2/extra/browscap.ini - owner=root - group=root + src: browscap.ini + dest: /etc/{{ php_base_dir }}/apache2/extra/browscap.ini + owner: root + group: root when: php_browscap notify: - - "Apache | Restart Apache" + - "Restart Apache" -- name: PHP | Create htdocs directory for apc status +- name: Create htdocs directory for apc status file: - dest=/var/www/apc - state=directory - owner=www-data - group=www-data + dest: /var/www/apc + state: directory + owner: www-data + group: www-data -- name: PHP | Copy APC status php script +- name: Copy APC status php script copy: - src=apc.php - dest=/var/www/apc - owner=www-data - group=www-data + src: apc.php + dest: /var/www/apc + owner: www-data + group: www-data - include_tasks: oci-{{ php_version|default('5.5') }}.yml when: repository is defined and php_needs_oci8 @@ -112,67 +112,69 @@ - import_tasks: msodbc.yml when: php_needs_msodbc -- name: PHP | Ensure ImageMagick config directory +- name: Ensure ImageMagick config directory file: - dest={{ php_imagick_config_dir }} - state=directory - owner=root - group=root - mode='755' + dest: '{{ php_imagick_config_dir }}' + state: directory + owner: root + group: root + mode: 0755 -- name: PHP | ImageMagick Policy File +- name: ImageMagick Policy File template: - src=etc-imagemagick-policy.xml - dest={{ php_imagick_config_dir }}/policy.xml - owner=root - group=root - mode='644' + src: etc-imagemagick-policy.xml + dest: '{{ php_imagick_config_dir }}/policy.xml' + owner: root + group: root + mode: 0644 - block: - - name: PHP | Apache FPM Socket Configuration - template: - src='etc-apache2-conf-available-php-fpm' - dest='/etc/apache2/{{ apache_conf_dir }}/php{{ php_version_main }}-fpm.conf' - owner='root' - group='root' - mode='644' - notify: - - "Apache | Restart Apache" - - - name: PHP | Enable Apache PHP FPM Configuration - command: a2enconf php{{ php_version_main }}-fpm creates=/etc/apache2/conf-enabled/php{{ php_version_main }}-fpm{{ apache_conf_ext }} - notify: - - "Apache | Restart Apache" + - name: Apache FPM Socket Configuration + template: + src: etc-apache2-conf-available-php-fpm + dest: /etc/apache2/{{ apache_conf_dir }}/php{{ php_version_main }}-fpm.conf + owner: root + group: root + mode: 0644 + notify: + - "Restart Apache" + + - name: Enable Apache PHP FPM Configuration + command: a2enconf php{{ php_version_main }}-fpm + args: + creates: /etc/apache2/conf-enabled/php{{ php_version_main }}-fpm{{ apache_conf_ext }} + notify: + - "Restart Apache" when: php_fpm_socket -- name: PHP | FPM Default Pool Configuration +- name: FPM Default Pool Configuration template: - src=php_pool.conf - dest=/etc/{{ php_base_dir }}/fpm/pool.d/www.conf - owner=root - group=root - mode='644' + src: php_pool.conf + dest: /etc/{{ php_base_dir }}/fpm/pool.d/www.conf + owner: root + group: root + mode: 0644 when: (php_version_main|default('7') == '7') and (jailkit is not defined or not jailkit) and (php_fpm) - block: - - set_fact: - phpLogRotatePrefix='{{php_version|default("7.0")}}' - phpLibPrefix='' - when: php_version_main|default('7') == '7' - - set_fact: - phpLogRotatePrefix='5' - phpLibPrefix='5' - when: php_version_main|default('7') != '7' - - - name: Install logrotate script - template: - src=etc-logrotate-php - dest=/etc/logrotate.d/php{{ phpLogRotatePrefix }}-fpm - owner=root - group=root - mode='644' + - set_fact: + phpLogRotatePrefix: '{{php_version|default("7.0")}}' + phpLibPrefix: '' + when: php_version_main|default('7') == '7' + - set_fact: + phpLogRotatePrefix: '5' + phpLibPrefix: '5' + when: php_version_main|default('7') != '7' + + - name: Install logrotate script + template: + src: etc-logrotate-php + dest: /etc/logrotate.d/php{{ phpLogRotatePrefix }}-fpm + owner: root + group: root + mode: 0644 when: php_fpm tags: - logrotate diff --git a/tasks/php53.yml b/tasks/php53.yml index d51cee83bfb915214ac5ed4e37f02152e0de074e..680b8ce5866fcf7d30eece9ead5e7d52e3004485 100644 --- a/tasks/php53.yml +++ b/tasks/php53.yml @@ -5,32 +5,32 @@ - name: Ensure PHP53 config directory file: - dest='{{ item }}' - state='directory' + dest: '{{ item }}' + state: directory with_items: - /etc/{{ php_base_dir }}/fpm/pool.d/ - name: Check PHP 5.3 Requirement shell: php --version register: php_version_available - changed_when: false + changed_when: no - block: - name: Package Preferences template: - src='preferences/{{ item }}' - dest='/etc/apt/preferences.d/{{ item }}-pin' - owner='root' - group='root' - mode='644' + src: preferences/{{ item }} + dest: /etc/apt/preferences.d/{{ item }}-pin + owner: root + group: root + mode: 0644 with_items: - openssl - libssl - name: Install Packages apt: - pkg={{ packages }} - state=present + pkg: '{{ packages }}' + state: present vars: packages: - autoconf2.13 @@ -67,31 +67,33 @@ - name: Link Client Lib file: - src='/usr/lib/libc-client.a' - dest='/usr/lib/x86_64-linux-gnu/libc-client.a' - state='link' + src: /usr/lib/libc-client.a + dest: /usr/lib/x86_64-linux-gnu/libc-client.a + state: link - name: Make sure an empty directory /tmp/php53 exists file: - path='/tmp/php53' - state='{{ item }}' + path: /tmp/php53 + state: '{{ item }}' with_items: - absent - directory - name: Download PHP 5.3 get_url: - url='http://in1.php.net/distributions/php-5.3.29.tar.bz2' - dest='/tmp/php-5.3.29.tar.bz2' + url: http://in1.php.net/distributions/php-5.3.29.tar.bz2 + dest: /tmp/php-5.3.29.tar.bz2 - name: Unpack PHP 5.3 unarchive: - src='/tmp/php-5.3.29.tar.bz2' - dest='/tmp/php53' - copy=no + src: /tmp/php-5.3.29.tar.bz2 + dest: /tmp/php53 + copy: no - name: Compile PHP 5.3 - shell: "{{ item }} chdir=/tmp/php53/php-5.3.29" + shell: '{{ item }}' + args: + chdir: /tmp/php53/php-5.3.29 with_items: - ./configure --with-libdir=/lib/x86_64-linux-gnu --enable-fpm --enable-mbstring --enable-sockets --with-zlib --enable-zip --with-imap-ssl --with-imap --with-curl --with-mcrypt --with-gd --with-mysql --with-pdo-mysql --with-mysqli --with-gettext --with-jpeg-dir=/usr --with-png-dir=/usr --with-kerberos --with-openssl --disable-cgi - make @@ -99,11 +101,11 @@ - name: Create PHP53 Start Script template: - src='etc-init-d-php53-fpm' - dest='/etc/init.d/php-fpm' - owner='root' - group='root' - mode='755' + src: etc-init-d-php53-fpm + dest: /etc/init.d/php-fpm + owner: root + group: root + mode: 0755 - name: Add PHP-FPM to Boot-List command: update-rc.d php-fpm defaults @@ -112,49 +114,49 @@ - name: Copy PHP53 Libraries copy: - src='php53/libs/{{ item.file }}' - dest='{{ php53.libdir }}/{{ item.file }}' - owner='root' - group='root' - mode='644' + src: php53/libs/{{ item.file }} + dest: '{{ php53.libdir }}/{{ item.file }}' + owner: root + group: root + mode: 0644 with_items: '{{ php53.libraries }}' - name: Ensure PHP53 Library Links file: - src='{{ php53.libdir }}/{{ item.file }}' - dest='{{ php53.libdir }}/{{ item.link }}' - state='link' - owner='root' - group='root' - mode='644' + src: '{{ php53.libdir }}/{{ item.file }}' + dest: '{{ php53.libdir }}/{{ item.link }}' + state: link + owner: root + group: root + mode: 0644 with_items: '{{ php53.libraries }}' - name: Ensure extra Library Links file: - src='{{ item.src }}' - dest='{{ php53.libdir }}/{{ item.link }}' - state='link' - owner='root' - group='root' - mode='644' + src: '{{ item.src }}' + dest: '{{ php53.libdir }}/{{ item.link }}' + state: link + owner: root + group: root + mode: 0644 with_items: '{{ php53.liblinks }}' - name: Copy PHP53 Modules copy: - src='php53/{{ item }}.so' - dest='{{ php53.extdir }}/{{ item }}.so' - owner='root' - group='root' - mode='644' + src: php53/{{ item }}.so + dest: '{{ php53.extdir }}/{{ item }}.so' + owner: root + group: root + mode: 0644 with_items: '{{ php53.modules }}' - name: Create PHP53 INI Files template: - src='etc-php5-apache2-php.ini' - dest='/etc/{{ php_base_dir }}/{{ item }}/php.ini' - owner='root' - group='root' - mode='644' + src: etc-php5-apache2-php.ini + dest: /etc/{{ php_base_dir }}/{{ item }}/php.ini + owner: root + group: root + mode: 0644 with_items: - cgi53 - cli53