manala / ansible-roles

Manala ansible roles
https://galaxy.ansible.com/manala/
MIT License
144 stars 36 forks source link

[PHP] Error while provisionning since `php8.0-json` package does not exist #548

Closed Kocal closed 3 years ago

Kocal commented 3 years ago

Hi! :wave:

I can finally try my work at #509 but I faced the following issue while running make setup or make provision:

TASK [manala.php : install > Packages presents] ********************************
fatal: [localhost]: FAILED! => {"cache_update_time": 1616793064, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'php8.0-cli' 'php8.0-fpm' 'php8.0-opcache' 'php8.0-readline' 'php8.0-json' 'php-xdebug' 'php8.0-mysql' 'php8.0-mbstring' 'php8.0-zip' 'php8.0-bz2' 'php-redis' 'php8.0-intl' 'php8.0-curl' 'php8.0-xml' 'php8.0-pgsql' -o APT::Install-Recommends=no' failed: E: Package 'php8.0-json' has no installation candidate\n", "rc": 100, "stderr": "E: Package 'php8.0-json' has no installation candidate\n", "stderr_lines": ["E: Package 'php8.0-json' has no installation candidate"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nPackage php8.0-json is a virtual package provided by:\n  php8.0-phpdbg 8.0.3-1+0~20210305.17+debian9~1.gbp899a74\n  php8.0-fpm 8.0.3-1+0~20210305.17+debian9~1.gbp899a74\n  php8.0-cli 8.0.3-1+0~20210305.17+debian9~1.gbp899a74\n  php8.0-cgi 8.0.3-1+0~20210305.17+debian9~1.gbp899a74\n  libphp8.0-embed 8.0.3-1+0~20210305.17+debian9~1.gbp899a74\n  libapache2-mod-php8.0 8.0.3-1+0~20210305.17+debian9~1.gbp899a74\n\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "Package php8.0-json is a virtual package provided by:", "  php8.0-phpdbg 8.0.3-1+0~20210305.17+debian9~1.gbp899a74", "  php8.0-fpm 8.0.3-1+0~20210305.17+debian9~1.gbp899a74", "  php8.0-cli 8.0.3-1+0~20210305.17+debian9~1.gbp899a74", "  php8.0-cgi 8.0.3-1+0~20210305.17+debian9~1.gbp899a74", "  libphp8.0-embed 8.0.3-1+0~20210305.17+debian9~1.gbp899a74", "  libapache2-mod-php8.0 8.0.3-1+0~20210305.17+debian9~1.gbp899a74", ""]}

(those commands are wrapper around vagrant provision) image

It seems that the JSON support is already integrated to PHP since 8.0, there is no ext-json anymore and no package php8.0-json either.

I've tried to investigate a bit, but I don't understand how image results to installing 'php8.0-cli' 'php8.0-fpm' 'php8.0-opcache' 'php8.0-readline' 'php8.0-json' 'php-xdebug' 'php8.0-mysql' 'php8.0-mbstring' 'php8.0-zip' 'php8.0-bz2' 'php-redis' 'php8.0-intl' 'php8.0-curl' 'php8.0-xml' 'php8.0-pgsql' packages.

Note that I don't require the JSON extension myself: image

Do you know what can happens and how can we fix it? Thanks!

nervo commented 3 years ago

Hello 🤝

Yep, json extension is now embedded in php starting from version 8 :)

Here, at elao, we use a special condition to not include it, depending on php version. See: https://github.com/manala/manala-recipes/blob/master/elao.app/.manala/ansible/inventories/system.yaml.tmpl#L334

I'm afraid you are using our oooold and deprecated skeleton role, which don't handle this situation.. Am i right ?

Kocal commented 3 years ago

Well, yeah we always use the "old" skeleton generated by Manalize if I'm not wrong.

I'm will migrate to it and see what happens, thank you!

nervo commented 3 years ago

Feel free to contact me directly, we have solutions :)

Kocal commented 3 years ago

For people having the same issue than me, I was able to not install the JSON extension by doing this:

# ansible/group_vars/app.yaml
app_patterns:
    # ...
    php_extensions:
        - extension: json
          state: ignore

        # Symfony
        - intl
        - curl
        - mbstring
        - xml
        # App
        - pgsql

Since this list is merged with the skeleton's php_extensions, passing state: ignore does not install the extension: image

Kocal commented 3 years ago

I suppose we can close it, since a solution has been given and updating the outdated skeleton is not the right solution IMO.