kosssi.composer
ansible-role-composer
This role installs Composer, a tool for managing PHP dependencies.
Default Variables
composer_path
: /usr/local/bin/composercomposer_update
: truecomposer_update_day
: 20
This is the location where Composer will be installed and accessible on your system. It should be in your user's $PATH
, so you can run commands with just composer
instead of typing the full path.
You can also set up a global directory for Composer and automatically add the bin directory to your $PATH
by using:
composer_path_env
: truecomposer_home_path
: /opt/composercomposer_home_owner
: rootcomposer_home_group
: rootcomposer_global_packages
:- phpunit/phpunit: "@stable"
Auth.json
GitHub OAuth Token
If your project relies heavily on libraries from GitHub, you may get this message during composer install
:
Could not fetch `...`, enter your GitHub credentials to go over the API rate limit.
A token will be created and stored in "~/.composer/auth.json", your password will never be stored.
To revoke access to this token, visit https://github.com/settings/applications.
This means your composer install
might hang.
To avoid this, you need to set up a GitHub OAuth token to bypass the API rate limit. Go to https://github.com/settings/applications, generate a personal access token, and assign it to the variable composer_github_oauth
.
composer_github_oauth
: f03401aae1e276abb073f987c08a32410f462e73
HTTP Basic Authentication
You can provide HTTP Basic auth details for any repository like this:
composer_http_basic:
repo.magento.com:
username: 52fe41da9d8caa70538244c10f367d0a
password: 238fe32d374a2573c4527bd45a7e6f54
Example Playbook
roles:
- { role: kosssi.composer }
Testing
If you have Vagrant installed, you can test this role with:
cd tests
vagrant up
vagrant provision