ansible 中沒有可用的與 ** 相符的軟體包

ansible 中沒有可用的與 ** 相符的軟體包

我正在嘗試使用 ansible 安裝軟體包列表,但我似乎不明白問題是什麼。

- 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

但是,當我運行劇本時,出現以下錯誤:

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"}

在我正在測試的伺服器上,可以安裝所有軟體包。那不是問題。有什麼想法嗎?我在 ubuntu 16.04 上運行 ansible 2.6.3,並且嘗試在運行相同作業系統的另一個系統上安裝這些軟體包。

答案1

您收到的錯誤在相關部分指出:

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

這是因為該功能在 7.2 中已從 PHP 中刪除,因此不再有相應的 Ubuntu/Debian 軟體包。

文件狀態:

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

此功能仍可作為外部 PECL 封裝使用。但與 Red Hat/Fedora 不同,Red Hat/Fedora 提供了適用於 PHP 7.2 的 PECL mcrypt 軟體包,Ubuntu/Debian 打包者選擇不打包它。如果您有需要它的古老 PHP 程式碼,您仍然可以從 PECL 手動安裝它。

相關內容