Skip to content
Snippets Groups Projects
php.yml 2.89 KiB
Newer Older
  • Learn to ignore specific revisions
  • jurgenhaas's avatar
    jurgenhaas committed
    ---
    # file: roles/php/tasks/php.yml
    
    - name: "PHP | Install required packages."
      apt:
        pkg={{ item }}
        state=installed
      with_items:
        - php5
        - php-apc
        - php-soap
    
    jurgenhaas's avatar
    jurgenhaas committed
        - php5-mysql
        - php5-xmlrpc
        - php5-gd
    
    jurgenhaas's avatar
    jurgenhaas committed
        - php5-imagick
    
    jurgenhaas's avatar
    jurgenhaas committed
        - php5-mcrypt
        - php5-imap
        - php5-curl
        - php5-xdebug
        - php5-dev
        - php-pear
    
    jurgenhaas's avatar
    jurgenhaas committed
        - imagemagick
    
      notify:
        - "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
    - name: "PHP | Enable Apache modules"
      apache2_module:
        name={{ item }}
        state=present
      with_items:
        - fcgid
    
    jurgenhaas's avatar
    jurgenhaas committed
      when: not php_called_from_apache
      notify: "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    - name: "PHP | Configuration file, php.ini"
      template:
        src=etc-php5-apache2-php.ini
        dest=/etc/php5/apache2/php.ini
        owner=root
        group=root
        mode=0644
    
    jurgenhaas's avatar
    jurgenhaas committed
      when: not php_called_from_apache
    
      notify:
        - "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
    - include: php53.yml
      when: php_version|default('5.5') == '5.3'
    
    
    - name: "PHP | Configuration file, fcgid.conf"
      template:
        src=fcgid.conf
        dest=/etc/apache2/mods-available/fcgid.conf
        owner=root
        group=root
        mode=0644
    
    jurgenhaas's avatar
    jurgenhaas committed
      when: not php_called_from_apache
    
      notify:
        - "PHP | Restart Apache"
    
    # TODO: Upgrade APCu on Ubuntu 14.04
    # @see https://github.com/owncloud/core/issues/14175#issuecomment-74573088
    # wget https://launchpad.net/~ondrej/+archive/ubuntu/php5/+build/6149263/+files/php5-apcu_4.0.6-1%2Bdeb.sury.org~utopic%2B1_amd64.deb
    # sudo dpkg -i php5-apcu_4.0.6-1+deb.sury.org~utopic+1_amd64.deb
    
    
    jurgenhaas's avatar
    jurgenhaas committed
    - name: "PHP | Cache configuration file, apc.ini"
      template:
        src=etc-php5-conf-d-apc.ini
        dest=/etc/php5/{{ php_conf_dir }}/apc.ini
        owner=root
        group=root
        mode=0644
    
      notify:
        - "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    - name: "PHP | Create extra directory for browscap"
      file:
        dest=/etc/php5/apache2/extra
        state=directory
        owner=root
        group=root
      when: php_browscap
    
    - name: "PHP | browscap.ini"
      copy:
        src=browscap.ini
        dest=/etc/php5/apache2/extra/browscap.ini
        owner=root
        group=root
    
    jurgenhaas's avatar
    jurgenhaas committed
      when: not php_called_from_apache and php_browscap
    
      notify:
        - "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    - name: "PHP | Enable PHP modules"
      shell: php5enmod {{ item }}
      with_items:
        - mcrypt
        - imap
    
    jurgenhaas's avatar
    jurgenhaas committed
        - imagick
    
    jurgenhaas's avatar
    jurgenhaas committed
      when: php_conf_dir == 'mods-available'
    
      notify:
        - "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    - name: "PHP | Create htdocs directory for apc status"
      file:
        dest=/var/www/apc
        state=directory
        owner=www-data
        group=www-data
    
    - name: "PHP | Copy APC status php script"
      copy:
        src=apc.php
        dest=/var/www/apc
        owner=www-data
        group=www-data
    
    - name: "PHP | Check OCI Requirement"
      shell: ls /usr/lib/php5/20090626/pdo_oci.so
      register: oci_available
      when: php_needs_oci8
      ignore_errors: yes
      changed_when: oci_available.stdout != '/usr/lib/php5/20090626/pdo_oci.so'
    
      notify:
        - "PHP | Restart Apache"
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    - include: oci.yml
      when: repository is defined and php_needs_oci8 and oci_available.stdout != '/usr/lib/php5/20090626/pdo_oci.so'