Skip to content
Collection of PHP roles for Ansible
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
roles Add php_xhprof submodule. Aug 6, 2019
.gitignore Issue #1: Configure automated integration tests and set up Travis CI. Aug 7, 2019
.gitmodules Use publicly-accessible submodule paths. Aug 7, 2019
.travis.yml Issue #1: More directory traversal shenanigans. Aug 7, 2019 Fix instructions for building a new version. Aug 8, 2019
galaxy.yml Fix some links in galaxy.yml. Aug 8, 2019

PHP Roles Collection for Ansible

Build Status

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

It includes:


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

    - geerlingguy.php_roles

    - php
    - role: php-versions
        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.


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 test/), 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

Currently the process of building and pushing a new version artifact to Galaxy is manual. This process will be automated based on tags/releases via Travis CI soon, but for now, here is how to release a new version:

  1. Make sure the version string in galaxy.yml matches the version of the collection you wish to publish (should correspond to the latest Git tag).
  2. Build the collection artifact: ansible-galaxy collection build
  3. Publish the collection artifact: ansible-galaxy collection publish ./geerlingguy-php_roles-1.2.3.tar.gz --api-key=[key goes here]

Note: The above commands require Ansible 2.9 (Ansible's devel branch as of mid-2019) or later.


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

You can’t perform that action at this time.