Muhammad Taqi
Muhammad Taqi

Reputation: 5424

Unable to locate package php5-redis Ubuntu 14.04

i am trying install php5 on Ubuntu 14.04 via ansible as below

- name: add ondrej ppa
  become: true
  apt_repository: repo=ppa:ondrej/php

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

- name: Install PHP
  sudo: true
  apt: pkg={{ item }} state=latest
  with_items: "{{ php__packages }}"

And

php__ppa: name=php5 state=latest
php__packages:
  - php5-fpm
  - php5-cli
  - php5-curl
  - php5-mcrypt
  - php5-common
  - php5-json
  - php5-intl
  - php5-gd
  - php5-mysql
  - php5-redis
  - php5-imagick
  - php5-mhash
  - php5-sqlite

and got this

TASK [common-php : Install PHP] ************************************************ failed: [symfony-demo] (item=[u'php5-fpm', u'php5-cli', u'php5-curl', u'php5-mcrypt', u'php5-common', u'php5-json', u'php5-intl', u'php5-gd', u'php5-mysql', u'php5-redis', u'php5-ldap', u'php5-imagick', u'php5-mhash', u'php5-sqlite']) => {"failed": true, "item": ["php5-fpm", "php5-cli", "php5-curl", "php5-mcrypt", "php5-common", "php5-json", "php5-intl", "php5-gd", "php5-mysql", "php5-redis", "php5-ldap", "php5-imagick", "php5-mhash", "php5-sqlite"], "msg": "No package matching 'php5-redis' is available"}

I tried this too sudo apt-get install php5-redis but got same Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package php5-redis

Upvotes: 1

Views: 1861

Answers (1)

Arbab Nazar
Arbab Nazar

Reputation: 23771

I have modified the playbook like this:

- hosts: all
  become: yes
  vars:
    php_packages:
      - php5
      - php5-fpm
      - php5-cli
      - php5-curl
      - php5-mcrypt
      - php5-common
      - php5-json
      - php5-intl
      - php5-gd
      - php5-mysql
      - php5-redis
      - php5-imagick
      - php5-mhash
      - php5-sqlite
  tasks:
    - name: Add PPA apt key
      apt_key:
        id: "E5267A6C"
        keyserver: "keyserver.ubuntu.com"
        state: present

    - name: add ondrej ppa
      apt_repository:
        repo: "ppa:ondrej/php"

    - name: Update apt
      apt:
        update_cache: yes

    - name: Install PHP
      apt:
        name: "{{ item }}"
        state: latest
      with_items: "{{ php_packages }}"

And then I run the playbook:

ansible-playbook -i 192.168.33.10, php5.yml

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [192.168.33.10]

TASK [Add PPA apt key] *********************************************************
changed: [192.168.33.10]

TASK [add ondrej ppa] **********************************************************
changed: [192.168.33.10]

TASK [Update apt] **************************************************************
changed: [192.168.33.10]

TASK [Install PHP] *************************************************************
changed: [192.168.33.10] => (item=[u'php5', u'php5-fpm', u'php5-cli', u'php5-curl', u'php5-mcrypt', u'php5-common', u'php5-json', u'php5-intl', u'php5-gd', u'php5-mysql', u'php5-redis', u'php5-imagick', u'php5-mhash', u'php5-sqlite'])

PLAY RECAP *********************************************************************
192.168.33.10              : ok=5    changed=4    unreachable=0    failed=0

Hope that help you

Upvotes: 1

Related Questions