Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This role overrides php_packages, which is also used in geerlingguy.php #46

Closed
mloveday opened this issue Dec 20, 2019 · 11 comments
Closed

Comments

@mloveday
Copy link

Our playbook has the following config defined:

vars:
  php_packages:
    - php{{ php_version }}-intl
    - php{{ php_version }}-zip
    ...
roles:
  - geerlingguy.php-versions
  - geerlingguy.php
  ...

When we run the playbook, the php packages we were specifying were not being installed. We found that geerlingguy.php_versions was setting php_packages to that role's default value, and geerlingguy.php was then using this default over our user-specified value. We tried specifying php_packages in vars as above, in a vars file, and inline with the role itself (- { role: geerlingguy.php, vars: php_packages: ... }), but nothing changed.

The only way we could work around this was by defining the php_packages variable in a new role after php-versions had run:

vars:
  php_packages:
    - php{{ php_version }}-cli
    - php{{ php_version }}-zip
    ...
roles:
  - geerlingguy.php-versions
  - php-packages
  - geerlingguy.php
  ...

... with the php-packages role containing the following ...

set_fact: php_packages="{{ custom_php_packages }}"

Firstly, is there something I'm doing wrong in specifying the php_packages variable? If it's something I've done wrong, what should I change and why is this particular use case different to others?

Is it just a case of renaming this role's (internal only?) variable to something more unique? If so, I'm happy to provide a PR.

Thanks!

@stale
Copy link

stale bot commented Mar 19, 2020

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@stale stale bot added the stale label Mar 19, 2020
@webarchitect609
Copy link
Contributor

Today I have found this issue as affecting my playbook. I also have examined and tested the proposed solution - PR #39. It works with both - playbook vars and host vars.

@mloveday , as a temporary solution you can create host vars to avoid overwriting variables and also avoid endless waiting for PR #39 to be merged. I.e. create file ~/host_vars/hostname.yml where ~ = folder where your playbook or inventory file is; hostname = hostname, against which you use this role in your playbook. Reason: PR #4 let the tasks/main.yml file to watch for host vars only.

@stale
Copy link

stale bot commented Apr 8, 2020

This issue is no longer marked for closure.

@stale stale bot removed the stale label Apr 8, 2020
@webarchitect609
Copy link
Contributor

@mloveday, another option is to use my fork webarchitect609.php_versions, where it has been fixed.

@ymhuang0808
Copy link

@mloveday, another option is to use my fork webarchitect609.php_versions, where it has been fixed.

It works for me.

@pierregaste
Copy link

Same for me. Thanks for this workaround!

@stale
Copy link

stale bot commented Aug 9, 2020

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@stale stale bot added the stale label Aug 9, 2020
@stale
Copy link

stale bot commented Sep 9, 2020

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

@webarchitect609
Copy link
Contributor

@geerlingguy, I would like you to check this issue again. I believe this is a bug, formulated as: impossible to set php_packages from a playbook when using geerlingguy.php with geerlingguy.php-versions.

The fix is simple and I re-make PR #39 as a fresh PR #55 . Thank you! :)

@geerlingguy geerlingguy reopened this Feb 22, 2021
@stale
Copy link

stale bot commented Feb 22, 2021

This issue is no longer marked for closure.

@stale stale bot removed the stale label Feb 22, 2021
@geerlingguy
Copy link
Owner

Fixed in #55.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants