geerlingguy / ansible-collection-php_roles

Collection of PHP roles for Ansible
https://galaxy.ansible.com/geerlingguy/php_roles
MIT License
30 stars 14 forks source link

Unmet dependency? geerlingguy.php vs geerlingguy.php_roles.php #6

Open basictheprogram opened 4 years ago

basictheprogram commented 4 years ago

Trying to get this collection working and I'm getting unmet dependencies.

$ ansible-galaxy collection install geerlingguy.php_roles
Process install dependency map
Starting collection install process
Skipping 'geerlingguy.php_roles' as it is already installed

converge.yml

---
  - name: Converge
    hosts: all
    become: true

    environment:
      DEBIAN_FRONTEND: "noninteractive"

    collections:
      - geerlingguy.php_roles

    roles:
      - geerlingguy.mysql
      - geerlingguy.php_roles.php
      - geerlingguy.php_roles.php_mysql

molecule.yml

---
  dependency:
    name: galaxy
  driver:
    name: docker
  lint: |
    set -e
    yamllint .
    ansible-lint
  platforms:
    - name: ubuntu-20.04
      image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
      command: ${MOLECULE_DOCKER_COMMAND:-""}
      volumes:
        - /sys/fs/cgroup:/sys/fs/cgroup:ro
      privileged: true
      pre_build_image: true
  provisioner:
    name: ansible
    env:
      ANSIBLE_COLLECTIONS_PATHS: "/Users/tanner/.ansible/collections"
      ANSIBLE_ROLES_PATHS: "/Users/tanner/.ansible/roles"
    playbooks:
      converge: ${MOLECULE_PLAYBOOK:-converge.yml}
  verifier:
    name: ansible
$ molecule test
<snip>
ERROR! the role 'geerlingguy.php' was not found in geerlingguy.php_roles:ansible.legacy:/Users/tanner/projects/py3-ansible/src/playbooks.git/roles/wordpress_server/molecule/default/roles:/Users/tanner/.cache/molecule/wordpress_server/default/roles:/Users/tanner/projects/py3-ansible/src/playbooks.git/roles:/Users/tanner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/Users/tanner/.ansible/collections/ansible_collections/geerlingguy/php_roles/roles:/Users/tanner/projects/py3-ansible/src/playbooks.git/roles/wordpress_server/molecule/default

The error appears to be in '/Users/tanner/.ansible/collections/ansible_collections/geerlingguy/php_roles/roles/php_mysql/meta/main.yml': line 3, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

dependencies:
  - geerlingguy.php
    ^ here
ERROR:
An error occurred during the test sequence action: 'syntax'. Cleaning up.

Do I need install the geerlingguy.php role and the php_roles collection?

I see the php role in ~/.ansible/collections/ansible_collections/geerlingguy/php_roles/roles?

basictheprogram commented 4 years ago

Changed ~/.ansible/collections/ansible_collections/geerlingguy/php_roles/roles/php_mysql/meta/main.yml to this

---
dependencies:
  - geerlingguy.php_roles.php

Fixes my problem, but documentation states the php_mysql role is a submodule and to do work on the upstream project so I do not know if I changing the upstream role is the proper fix.

dschaaff commented 3 years ago

I worked around this by adding the the role directly in addition to the collection. Annoying but it works without messing with code.

# this due to a bug in the php collection where it only finds a pecl dependency if installed via a role.
  - src: geerlingguy.php
    version: 4.5.0