Skip to content

ansible-role-composer

License Build Status

Installs Composer, the PHP Dependency Manager.

Role Defaults Variables

1
2
3
composer_path: /usr/local/bin/composer
composer_update: true
composer_update_day: 20

The path where composer will be installed and available to your system. Should be in your user's $PATH so you can run commands simply with composer instead of the full path.

You can also setup a global composer directory and make the bin directory available in the $PATH automatically by:

1
2
3
4
5
composer_home_path: /opt/composer
composer_home_owner: root
composer_home_group: root
composer_global_packages:
  phpunit/phpunit: "@stable"

Auth.json

Github OAuth token

If your project use a lot of libraries from github, you may see next message during composer install:

1
2
3
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 you can visit https://github.com/settings/applications

So your composer install can get stuck.

To prevent that, you must configure github oauth token to go over the API rate limit. Visit https://github.com/settings/applications and generate personal access token and assign it to composer_github_oauth variable.

1
composer_github_oauth: f03401aae1e276abb073f987c08a32410f462e73

HTTP Basic auth

You can provide HTTP Basic auth credentials to any repository like this:

1
2
3
4
composer_http_basic:
    repo.magento.com:
        username: 52fe41da9d8caa70538244c10f367d0a
        password: 238fe32d374a2573c4527bd45a7e6f54

Example Playbook

1
2
  roles:
    - { role: kosssi.composer }

Tests

If you have vagrant, you can test this role:

1
2
3
cd tests
vagrant up
vagrant provision

Special thanks to contributors