You can download and use the role here: https://github.com/litwicki/ansible-php7

roles/php7/tasks/main.yml

---
- name: fix proxy for Ubuntu
  shell: sudo echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

- name: Update apt
  sudo: yes
  apt: update_cache=yes

- name: Install System Packages
  sudo: yes
  apt: pkg={{ item }} state=latest
  with_items:
    - curl
    - wget
    - snmp
    - build-essential
    - python-software-properties
    - python-pip
    - python-dev
    - opensssl
    - libssl-dev
    - libcurl4-openssl-dev
    - pkg-config

- name: Add repository for php7
  shell: DEBIAN_FRONTEND=noninteractive sudo add-apt-repository -y ppa:ondrej/php-7.0

- name: Update apt
  sudo: yes
  apt: update_cache=yes

- name: Purge php5 stuff
  shell: apt-get purge php5-fpm && sudo apt-get -y --purge autoremove

- name: Install php7 Packages
  sudo: yes
  apt: pkg={{ item }} state=latest
  with_items:
    - php7.0-fpm
    - php7.0-cli
    - php7.0-curl
    - php7.0-common
    - php7.0-json
    - php7.0-opcache
    - php7.0-mysql
    - php7.0-phpdbg
    - php7.0-dbg
    - php7.0-gd
    - php7.0-imap
    - php7.0-ldap
    - php7.0-pgsql
    - php7.0-pspell
    - php7.0-recode
    - php7.0-snmp
    - php7.0-tidy
    - php7.0-dev
    - php7.0-intl
    - php7.0-gd

- name: Install OAUTH PHP package
  sudo: yes
  shell: pecl install oauth

- name: Configure the timezone
  sudo: yes
  template: src=timezone.tpl dest=/etc/timezone

- name: More Configure the timezone
  sudo: yes
  file: src=/usr/share/zoneinfo/{{server.timezone}} dest=/etc/localtime state=link force=yes backup=yes

- name: Set default system language pack
  shell: locale-gen {{server.locale}}
  sudo: yes

 

Categories: Random

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *