PHP Roles Collection for Ansible

MIT licensed Galaxy Collection CI

This collection contains all the PHP-related roles maintained by Jeff Geerling (geerlingguy).

It includes:

Usage

Install this collection locally:

ansible-galaxy collection install geerlingguy.php_roles -p ./collections

Then you can use the roles from the collection in your playbooks:

---
- hosts: all

  collections:
    - geerlingguy.php_roles

  roles:
    - php
    - role: php-versions
      vars:
        php_version: '7.3'

If you want to be more explicit, you can use the fully-qualified role name when referring to a role in this collection, like geerlingguy.php_roles.php instead of just php. This could be helpful if, for example, you maintain a separate php role in another place on your local workstation.

Development

Currently, all the PHP roles (inside roles/) are Git submodules, and work on the roles themselves should take place in the upstream Role repository. At some point, the roles might move into this repository for their canonical home.

This collection has some integration tests (inside tests/), however, which pull all the roles together and ensure they work in tandem on the latest supported platforms.

The integrated tests use ansible-test. You can run them with the following command:

ansible-test integration --docker geerlingguy/docker-ubuntu1804-ansible

Note: You can switch out ubuntu1804 with any other supported operating system (e.g. centos7).

Pushing a new version

Before tagging a new version, make sure all the git submodules are up to date:

git submodule update --recursive --remote

Then commit and push all changes, and make sure all tests are passing.

Then tag the new version of the collection and push the tag.

Once pushed, GitHub actions will run the galaxy-deploy.yml playbook to deploy the new version.

Author

This collection was created in 2019 by Jeff Geerling, author of Ansible for DevOps and Ansible for Kubernetes.