0

I'm trying to install a list of packages with ansible, and I can't seem to understand what the problem is.

- name: Add PHP 7.2 repo
  apt_repository:
         repo: ppa:ondrej/php
         state: present
  register: ppastable

- name: install php7.2-fpm and all necessary modules
  apt: name={{ item }} state=present
  with_items:
     - php7.2-fpm
     - php7.2-gd
     - php7.2-curl
     - php7.2-mysql
     - php7.2-mcrypt
     - php7.2-mbstring
     - php7.2-xml
  update_cache: true
  when: ppastable is success

However, when I run the playbook, I get the following error:

failed: [172.31.110.103] (item=[u'php7.2-fpm', u'php7.2-gd', u'php7.2-curl', u'php7.2-mysql', u'php7.2-mcrypt', u'php7.2-mbstring', u'php7.2-xml']) => {"changed": false, "item": ["php7.2-fpm", "php7.2-gd", "php7.2-curl", "php7.2-mysql", "php7.2-mcrypt", "php7.2-mbstring", "php7.2-xml"], "msg": "No package matching 'php7.2-mcrypt' is available"}

On the server I'm testing this on, all the packages can be installed. That's not a problem. Any ideas what's going on? I'm running ansible 2.6.3 on ubuntu 16.04 and I'm trying to install the packages also on another system running the same OS.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
Lethargos
  • 455
  • 2
  • 7
  • 19
  • 2
    The [docs](https://secure.php.net/manual/en/intro.mcrypt.php) state: `This feature was DEPRECATED in PHP 7.1.0, and REMOVED in PHP 7.2.0.` – Michael Hampton Aug 28 '18 at 20:05
  • I didn't read ansible's error message correctly. I thought it was a general error, not an error related particularly to that package. My bad. Thanks for clearing that up for me :) – Lethargos Aug 29 '18 at 07:45

1 Answers1

2

The error you received states, in relevant part:

No package matching 'php7.2-mcrypt' is available

This is because this feature was removed from PHP in 7.2, so there is no longer a corresponding Ubuntu/Debian package.

The docs state:

This feature was DEPRECATED in PHP 7.1.0, and REMOVED in PHP 7.2.0.

The feature is still available as an external PECL package. But unlike in Red Hat/Fedora, which has a package for PECL mcrypt for PHP 7.2, Ubuntu/Debian packagers have chosen not to package it. You may still be able to install it manually from PECL if you have ancient PHP code that needs it.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972