Git Product home page Git Product logo

Comments (10)

geerlingguy avatar geerlingguy commented on June 19, 2024 3

This was fixed today in PR #64 — thanks!

from ansible-role-php-versions.

frock81 avatar frock81 commented on June 19, 2024

I stumbled upon this issue when trying to use php-versions role in conjunction with the php role. I tried setting the variable php_packages: ["php8.0"] of the php role to get around installing php8.0-json. The problem is that the php_packages is only set in that role if it was not defined before (line 20 task of geerlingguy.php/tasks/main.yml), thus it gets the default __php_packages. And the php_packages variable is defined (conditionally to hostvars) in the php-versions role (line 8 taks of geerlingguy.php-versions/tasks/main.yml).

I circumvent the problem by setting the php_packages between the roles execution:

---
- hosts: all
  tasks:
    - name: import php-versions role
      import_role:
        name: geerlingguy.php-versions

    - name: "set php_packages fact to circumvent issue #57"
      set_fact:
        php_packages:
          - php8.0

    - name: import php installation role
      import_role:
        name: geerlingguy.php

After that the installation proceeded. Maybe using hostvars is another way to make it work.

I don't have a good proposal to fix. Perhaps the same pattern of the php version role can be used in the php-versions role and set php_packages to __php_packages only if it is not defined before.

from ansible-role-php-versions.

frock81 avatar frock81 commented on June 19, 2024

On a second thought, these are two different problems. One is php8.0-json on a Debian as reported (which release?) or Ubuntu Focal, which I'm using, system and the other is the usage of the two roles with the php_packages variable.

from ansible-role-php-versions.

hedii avatar hedii commented on June 19, 2024

One is php8.0-json on a Debian as reported (which release?)

Debian 9

from ansible-role-php-versions.

rtuin avatar rtuin commented on June 19, 2024

I've also ran into this issue. Didn't find a way around except commenting the php-json line in the vars file.
I'd be happy to contribute a fix on this, however not sure what a good approach would be.
Do you have any suggestions here @geerlingguy?

from ansible-role-php-versions.

federicoaaguirre avatar federicoaaguirre commented on June 19, 2024

Hi there, in debian 10 it is still failing:
fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "The conditional check 'php_version is version('8.0', '>=')' failed. The error was: template error while templating string: no test named 'version'. String: {% if php_version is version('8.0', '>=') %} True {% else %} False {% endif %}\n\nThe error appears to have been in '/tmp/packer-provisioner-ansible-local/6068f2d6-4802-f5b4-976d-d2fb215b759d/roles-galaxy/php-versions/tasks/main.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Remove missing JSON extension for PHP 8.0 (included by default)\n ^ here\n"}

I've override php_version var with '7.4'

from ansible-role-php-versions.

geerlingguy avatar geerlingguy commented on June 19, 2024

@federicoaaguirre - What version of Ansible are you running? It looks like the version you're running is missing the version() jinja2 test plugin.

from ansible-role-php-versions.

federicoaaguirre avatar federicoaaguirre commented on June 19, 2024

Hi @geerlingguy thanks for your quick response.! I'm try it with 2.4.4 and also i've tried it with 2.9.

from ansible-role-php-versions.

geerlingguy avatar geerlingguy commented on June 19, 2024

Ansible 2.4 is extremely out of date (it's been out of support for a couple years).

2.9 or later should work perfectly fine though. If you can confirm that you have installed Ansible 2.9 and you're still getting that error, please consider opening a new bug report.

from ansible-role-php-versions.

federicoaaguirre avatar federicoaaguirre commented on June 19, 2024

@geerlingguy thansk again it works perfect with 2.9.

from ansible-role-php-versions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.