geerlingguy.composer

Ansible Role: Composer

CI

This role installs Composer, which is a tool to manage PHP dependencies, on any Linux or UNIX system.

Requirements

  • You need to have php version 5.4 or higher installed and working. You can use the geerlingguy.php role to install it.
  • You also need to have git installed and working. Use the geerlingguy.git role to install it.

Role Variables

Here are the available variables and their default values (see defaults/main.yml):

  • composer_path: The location where Composer will be installed. The default path is /usr/local/bin/composer. This should be in your user’s $PATH so you can use composer commands easily.

  • composer_keep_updated: Set to false by default. If you set it to true, Composer will be updated to the latest version every time you run the playbook.

  • composer_home_path: This is set to ~/.composer by default. It's the directory where globally installed packages will go.

  • composer_home_owner: The owner of the COMPOSER_HOME directory, default is root.

  • composer_home_group: The group of the COMPOSER_HOME directory, default is root.

  • composer_version: If you want a specific version of Composer, you can specify it here (e.g., composer_version: '1.0.0-alpha11'). If left empty, the latest version will install. Note that if composer_keep_updated is true, this setting will be ignored.

  • composer_version_branch: This sets the major version of Composer to use. The default is --2. If composer_keep_updated is true, it will always install the latest version from this branch.

  • composer_global_packages: This is a list of packages you want to install globally. You can specify packages with their name and optional release version, e.g., - { name: phpunit/phpunit, release: "4.7.*" }. If no release is specified, it will default to the stable version.

  • composer_add_to_path: If set to true, and you have any global packages configured, the vendor/bin directory inside composer_home_path will be added to the system’s default $PATH.

  • composer_project_path: Set this to the path of your Composer project.

  • composer_add_project_to_path: If set to true and a composer_project_path is configured, the vendor/bin directory inside that path will be added to the system’s default $PATH.

  • composer_github_oauth_token: This is a GitHub OAuth token. It helps avoid errors when hitting GitHub API rate limits while using Composer. Follow GitHub’s guide to create a personal access token if you encounter rate limit issues.

  • php_executable: This is the name or path to the PHP executable. It defaults to php unless you change it.

Using Composer 1

If you're working on projects that need Composer 1, set the following variables:

  • composer_version_branch: Leave empty.
  • composer_version: Set this to 1.10.12.

Dependencies

No dependencies other than having PHP installed. The geerlingguy.php role is recommended for PHP installation.

Example Playbook

- hosts: servers
  roles:
    - geerlingguy.composer

After running the playbook, composer will be installed in /usr/local/bin/composer (you can change this location), and it will be usable by normal system users.

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, who is also the author of Ansible for DevOps.

Informazioni sul progetto

Composer PHP Dependency Manager

Installa
ansible-galaxy install geerlingguy.composer
Licenza
mit
Download
9.3M
Proprietario
Father, author, developer, maker. Sometimes called "an inflammatory enigma". #stl #drupal #ansible #k8s #raspberrypi #crohns