PHP Roles Collection for Ansible
This collection contains all the PHP-related roles maintained by Jeff Geerling (geerlingguy).
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.phpinstead of just
php. This could be helpful if, for example, you maintain a separate
phprole 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
ubuntu1804with any other supported operating system (e.g.
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:
- Make sure the
galaxy.ymlmatches the version of the collection you wish to publish (should correspond to the latest Git tag).
- Build the collection artifact:
ansible-galaxy collection build
- 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
develbranch as of mid-2019) or later.