Coder Social home page Coder Social logo

geerlingguy / ansible-role-composer Goto Github PK

View Code? Open in Web Editor NEW
181.0 14.0 101.0 97 KB

Ansible Role - Composer PHP Dependency Manager

Home Page: https://galaxy.ansible.com/geerlingguy/composer/

License: MIT License

Jinja 100.00%
ansible role composer php dependency-manager packagist packages

ansible-role-composer's Introduction

ansible-role-composer's People

Contributors

alsar avatar b-galati avatar bbaassssiiee avatar bilge avatar danmichaelo avatar darienhf avatar eexit avatar gdubicki avatar geerlingguy avatar joestewart avatar msaladna avatar nkakouros avatar thom8 avatar wells avatar yannik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-composer's Issues

drupal/drupal-extension started failing due to mink dependency

This morning while running Drupal-VM - vagrant provision I started getting an error on "drupal/drupal-extension".

  • { name: drupal/drupal-extension, release: '*' }

The raw out put is in at https://gist.github.com/michaelpporter/2656f9f0990f16e05f06

There is also a deprecation warning.

[DEPRECATION WARNING]: Using bare variables is deprecated. Update your
playbooks so that the environment value uses the full variable syntax
('{{composer_global_packages}}'). This feature will be removed in a future
release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.

Installer Signature Comparison

Looking at the main installation task for the role, I notice there's currently no signature comparison/check being ran before running the downloaded Composer installation script (as suggested in the Composer docs). Given that the installer isn't coming from a distro-maintained repository the signature check would at least give a little extra security, certainly at the very least against mitm concerns.

Would you consider adding support for the signature check to the role? Or consider a pull request for the feature? I've got an implementation that I'm using in my own personal composer role that I'd be happy to submit as a PR if you're open to the feature. That feature is just about the only thing keeping me from migrating to this role, so it'd be great to see support added.

Configurable auth.json template

#7 added an Ansible template for Composer's auth.json file. Currently, this template only supports a GitHub OAuth token, and the template itself cannot be swapped out with a user-provided template. This makes it impossible to provide additional authentication credentials using this role, which is particularly important for Magento 2 users who are required to authenticate with Magento's repository to install Magento packages with Composer.

Ideally, the template path should be a configurable variable (defaulting to the included template) so that users can supply their own templates.

A more advanced approach might be to enhance the included template to support additional types of authentication through new variables like a composer_auth_http_basic list/map, though I doubt the need is common enough to warrant supporting that, so simply being able to change the template path should be sufficient.

Composer command plugin?

If I wanted to run any Composer commands as a task, I'd have to use the shell module.

Here's an example I was considering -- for adding a repository URL and requiring it.

- name: Add private repo URL to global
  composer:
    command: config
    arguments: repositories.drupal composer https://packagist.drupal-composer.org
    global: true
- name: Add project to global
   composer:
     command: require
     arguments: drupal/coder
     global: true

That's a little rough, but the concepts are there. Not sure if viable

tlsv1 alert protocol version (_ssl.c:590)

I am trying to download FSL ( a pipeline for MRI data analysis) with this . I keep receiving this error :tlsv1 alert protocol version (_ssl.c:590)
I cannot figure out what the problem is. any suggestions?

Add a task for composer self-updater

Let me know if this doesn't interest you, but composer doesn't appear to be updating like ever...
If you don't, I'll make up a little one myself but this is something everybody could be using.

Could you add a variable similar to that of drush such as keep_composer_updated and associate a task to run composer self-update as the root user?

composer_version not honored when a previous version is installed

if you specify a version using "composer_version" variable and composer is not installed previously, everything works ok, but if you want to upgrade/downgrade later on to a different composer version, and composer is already installed (no matter what version), the role finishes without doing anything but composer is not upgraded/downgraded.

As we work on specific versions of composer and upgrade to specific versions and not always to the latest, this role do not allow us to upgrade composer.

Automated tests failing for Fedora 29 with Ansible/Python dnf OSError

See failed build: https://travis-ci.org/geerlingguy/ansible-role-composer/jobs/456178714#L781

TASK [geerlingguy.git : Ensure git is installed (RedHat).] *********************
    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 2] No such file or directory: '/var/lib/dnf/rpmdb_lock.pid'
    fatal: [instance]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):
  File \"/root/.ansible/tmp/ansible-tmp-1542469395.61-17120609732222/AnsiballZ_dnf.py\", line 113, in <module>
    _ansiballz_main()
  File \"/root/.ansible/tmp/ansible-tmp-1542469395.61-17120609732222/AnsiballZ_dnf.py\", line 105, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File \"/root/.ansible/tmp/ansible-tmp-1542469395.61-17120609732222/AnsiballZ_dnf.py\", line 48, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File \"/tmp/ansible_dnf_payload_5abXku/__main__.py\", line 1079, in <module>
  File \"/tmp/ansible_dnf_payload_5abXku/__main__.py\", line 1068, in main
  File \"/tmp/ansible_dnf_payload_5abXku/__main__.py\", line 1047, in run
  File \"/tmp/ansible_dnf_payload_5abXku/__main__.py\", line 985, in ensure
  File \"/usr/lib/python2.7/site-packages/dnf/base.py\", line 847, in do_transaction
    tid = self._run_transaction(cb=cb)
  File \"/usr/lib/python2.7/site-packages/dnf/lock.py\", line 147, in __exit__
    os.unlink(self.target)
OSError: [Errno 2] No such file or directory: '/var/lib/dnf/rpmdb_lock.pid'
", "module_stdout": "", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}

Should `geerlingguy.php` not be defined as a dependency in meta/main.yml?

Without php, composer cannot be installed:

FAILED! => {"changed": false, "cmd": "php composer-installer.php", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}

In my opinion, a dependency of php should be defined like in for example: https://github.com/030/ansible-sensu-client/blob/master/meta/main.yml#L17

Now I have to define geerlingguy.php manually and I also have to put it above geerlingguy.composer, while if dependency would have been used then the latter would install php first

"/bin/sh: composer: command not found"

TASK [ansible-role-composer-master : Set php_executable variable to a default if not defined.] ***
skipping: [stackradio.local] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}

TASK [ansible-role-composer-master : Check if Composer is installed.] **********
ok: [stackradio.local] => {"changed": false, "stat": {"atime": 1462394386.143436, "checksum": "8cb414603614c033528c6988b03f98a1d834f5f4", "ctime": 1462394104.0745864, "dev": 64768, "exists": true, "gid": 0, "gr_name": "root", "inode": 51484252, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "md5": "992f9395613c9ed60c963181555ab77d", "mode": "0755", "mtime": 1462394101.1302123, "nlink": 1, "path": "/usr/local/bin/composer", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 1592154, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}}

TASK [ansible-role-composer-master : Download Composer installer.] *************
skipping: [stackradio.local] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}

TASK [ansible-role-composer-master : Run Composer installer.] ******************
skipping: [stackradio.local] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}

TASK [ansible-role-composer-master : Move Composer into globally-accessible location.] ***
skipping: [stackradio.local] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}

TASK [ansible-role-composer-master : Update Composer to latest version (if configured).] ***
skipping: [stackradio.local] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}

TASK [ansible-role-composer-master : Ensure composer directory exists.] ********
ok: [stackradio.local] => {"changed": false, "gid": 0, "group": "root", "mode": "0755", "owner": "root", "path": "/root/.composer", "size": 45, "state": "directory", "uid": 0}

TASK [ansible-role-composer-master : Add GitHub OAuth token for Composer (if configured).] ***
skipping: [stackradio.local] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}

TASK [ansible-role-composer-master : Install configured globally-required packages.] ***
failed: [stackradio.local](item={u'release': u'^3.0', u'name': u'slim/slim'}) => {"changed": true, "cmd": "COMPOSER_HOME=~/.composer composer global require slim/slim:^3.0 --no-progress", "delta": "0:00:00.008793", "end": "2016-05-04 22:05:09.008222", "failed": true, "item": {"name": "slim/slim", "release": "^3.0"}, "rc": 127, "start": "2016-05-04 22:05:08.999429", "stderr": "/bin/sh: composer: command not found", "stdout": "", "stdout_lines": [], "warnings": []}
to retry, use: --limit @dev.retry

I am on centos7, i have this issue which is impossible for composer to install packages.
But when i am on local machine console, composer is installed and even i can install packages manually.

[root@stackradio vagrant]# /bin/sh
sh-4.2# composer


/ / ____ ___ ____ ____ ________ _____
/ / / __ / __ `
_ / __ / __ / / _ / /
/ /**
/ /
/ / / / / / / /
/ / /
/ (** ) / /
__
/
**
// // // ./_/**///
/
/
Composer version 1.0.3 2016-04-29 16:30:15

Usage:
command [options] [arguments]

Solution ?

CentOS 7 sometimes fails at 'Download Composer installer' task

See downstream issue in the Drupal VM repo: geerlingguy/drupal-vm#1822

TASK [geerlingguy.composer : Download Composer installer.] *********************
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'url'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Error connecting to https://composer.github.io/installer.sig: Failed to connect to composer.github.io at port 443: [Errno -2] Name or service not known"}

Not quite sure what's causing this, maybe something with the checksum validation code... but it works in this role's own test suite on CentOS 7 using the exact same image.

However, since there's an easy-ish fix (get the contents of the signature using the uri module instead of using the url lookup plugin), I'm going to pursue that.

Add configuration directive to globally require packages

It would be awesome if I could use this role to automatically install a suite of packages globally. Something like:

composer_global_packages:
  - 'phpunit/phpunit'
  - 'behat/behat'
  - 'symfony/validation'

If this is easy to add, I humbly request it. :)

Set global config option

@geerlingguy:
How can the COMPOSER_PROCESS_TIMEOUT config option be globally set?
Does this role offer a mechanism? In composer config file? As environment variable?

Different php executable causes Composer to fail

I've installed PHP 5.5 using the geerlingguy.repo-remi and geerlingguy.php roles, which has resulted in my PHP executable being php55 rather than just php. Because of this, the tasks in this role fail because it's looking only for the php executable.

My original thought was to add a symlink, maybe in a custom role, or either make the executable configurable in this role, or inherit the default from geerlingguy.php, but I was interested on your thoughts @geerlingguy before I proceed with either option.

Here is my PHP role configuration:

php_enablerepo: remi
php_packages:
  - php55-php
  - php55-php-cli
  - php55-php-common
  - php55-php-gd
  - php55-php-mbstring
  - php55-php-pdo
  - php55-php-pear
  - php55-php-pecl-apc
  - php55-php-xml
  - php55-php-xmlrpc
php_conf_path: /opt/remi/php55/root/etc
php_webserver_daemon: httpd
php_date_timezone: "Europe/London"

Check for updated version

Hi. Thanks for this role, very useful. I have one problem though and that is staleness of composer. I would like it to detect when it becomes stale and needs an update.

composer_version_branch variable can't be use to update composer version

In my scenario, required composer version might change.

So composer --1 is installed and I would like to update to version --2

After installing composer with:
composer_version_branch: "--1"

And running the role again with:
composer_version_branch: "--2"

Composer isn't updated.

Not sure if there is a reason against this or another method to be used to achieve this.
Else I might look into doing a pull request.

Please advise.

FAILED: No such file or directory

Having a problem with DrupalVM failing to build and it's failing on geerlingguy.composer. Log looks like:

TASK [geerlingguy.composer : Set php_executable variable to a default if not defined.] ***
skipping: [nct]

TASK [geerlingguy.composer : Check if Composer is installed.] ******************
ok: [nct]

TASK [geerlingguy.composer : Download Composer installer.] *********************
changed: [nct]

TASK [geerlingguy.composer : Run Composer installer.] **************************
fatal: [nct]: FAILED! => {"changed": false, "cmd": "php composer-installer.php", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}

and my config.yml looks like:

---
# `vagrant_box` can also be set to geerlingguy/centos6, geerlingguy/centos7,
# geerlingguy/ubuntu1404, geerlingguy/ubuntu1204, parallels/ubuntu-14.04, etc.
vagrant_box: geerlingguy/ubuntu1604
vagrant_user: vagrant
vagrant_synced_folder_default_type: nfs
vagrant_gui: false

# If you need to run multiple instances of Drupal VM, set a unique hostname,
# machine name, and IP address for each instance.
vagrant_hostname: nct.dev
vagrant_machine_name: nct
vagrant_ip: 0.0.0.0

# Allow Drupal VM to be accessed via a public network interface on your host.
# Vagrant boxes are insecure by default, so be careful. You've been warned!
# See: https://docs.vagrantup.com/v2/networking/public_network.html
vagrant_public_ip: ""

# A list of synced folders, with the keys 'local_path', 'destination', and
# a 'type' of [nfs|rsync|smb] (leave empty for slow native shares). See
# http://docs.drupalvm.com/en/latest/extras/syncing-folders/ for more info.
vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # any of the build_* settings are 'true'. By default the folder is set to
  # the drupal-vm folder.
  - local_path: .
    destination: /var/www/drupalvm
    type: nfs
    create: true

# Memory and CPU to use for this VM.
vagrant_memory: 2048
vagrant_cpus: 1

# Minimum required versions.
drupalvm_vagrant_version_min: '1.8.6'
drupalvm_ansible_version_min: '2.2'

# Force use of ansible_local provisioner, even if Ansible is installed on host.
force_ansible_local: false

# The web server software to use. Can be either 'apache' or 'nginx'.
drupalvm_webserver: apache

# The database system to use. Can be either 'mysql' or 'pgsql'.
drupal_db_backend: mysql

# Set this to 'false' if you are using a different site deployment strategy and
# would like to configure 'vagrant_synced_folders' and 'apache_vhosts' manually.
drupal_build_makefile: false
drush_makefile_path: "{{ config_dir }}/drupal.make.yml"
drush_make_options: "--no-gitinfofile"

# Set 'build_makefile' to 'false' and this to 'true' if you are using a
# composer based site deployment strategy.
drupal_build_composer: false
drupal_composer_path: "{{ config_dir }}/drupal.composer.json"
drupal_composer_install_dir: "/var/www/drupalvm/drupal"
drupal_composer_dependencies:
  - "drupal/devel:1.x-dev"

# Set this to 'true' and 'build_makefile', 'build_composer' to 'false' if you
# are using Composer's create-project as a site deployment strategy.
drupal_build_composer_project: false
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev"
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction"

# Set this to 'false' if you don't need to install drupal (using the drupal_*
# settings below), but instead copy down a database (e.g. using drush sql-sync).
drupal_install_site: false

# Required Drupal settings.
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
drupal_core_owner: "{{ drupalvm_user }}"
drupal_db_user: drupal
drupal_db_password: drupal
drupal_db_name: drupal

# Settings for installing a Drupal site if 'install_site:' is 'true'.
drupal_major_version: 7
drupal_domain: "{{ vagrant_hostname }}"
drupal_site_name: "Drupal"
drupal_install_profile: standard
drupal_enable_modules: [ 'devel' ]
drupal_account_name: admin
drupal_account_pass: admin

# Additional arguments or options to pass to `drush site-install`.
drupal_site_install_extra_args: []

# Cron jobs are added to the vagrant user's crontab. Keys include name
# (required), minute, hour, day, weekday, month, job (required), and state.
drupalvm_cron_jobs: []

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_drush_aliases: true

# Helper variable to configure the PHP-FPM connection for each Apache
# VirtualHost in the `apache_vhosts` list.
apache_vhost_php_fpm_parameters: |
    <FilesMatch \.php$>
      SetHandler "proxy:fcgi://{{ php_fpm_listen }}"
    </FilesMatch>

# Apache VirtualHosts. Add one for each site you are running inside the VM. For
# multisite deployments, you can point multiple servernames at one documentroot.
# View the geerlingguy.apache Ansible Role README for more options.
apache_vhosts:
  - servername: "{{ drupal_domain }}"
    serveralias: "www.{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "adminer.{{ vagrant_hostname }}"
    documentroot: "{{ adminer_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "xhprof.{{ vagrant_hostname }}"
    documentroot: "{{ php_xhprof_html_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "pimpmylog.{{ vagrant_hostname }}"
    documentroot: "{{ pimpmylog_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "{{ vagrant_ip }}"
    serveralias: "dashboard.{{ vagrant_hostname }}"
    documentroot: "{{ dashboard_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

apache_packages_state: latest
apache_remove_default_vhost: true
apache_mods_enabled:
  - expires.load
  - ssl.load
  - rewrite.load
  - proxy.load
  - proxy_fcgi.load

# Nginx hosts. Each site will get a server entry using the configuration defined
# here. Set the 'is_php' property for document roots that contain PHP apps like
# Drupal.
nginx_hosts:
  - server_name: "{{ drupal_domain }} www.{{ drupal_domain }}"
    root: "{{ drupal_core_path }}"
    is_php: true

  - server_name: "adminer.{{ vagrant_hostname }}"
    root: "{{ adminer_install_dir }}"
    is_php: true

  - server_name: "xhprof.{{ vagrant_hostname }}"
    root: "{{ php_xhprof_html_dir }}"
    is_php: true

  - server_name: "pimpmylog.{{ vagrant_hostname }}"
    root: "{{ pimpmylog_install_dir }}"
    is_php: true

  - server_name: "{{ vagrant_ip }} dashboard.{{ vagrant_hostname }}"
    root: "{{ dashboard_install_dir }}"
    is_php: true

nginx_remove_default_vhost: true
nginx_ppa_use: true

# MySQL databases and users.
mysql_databases:
  - name: "{{ drupal_db_name }}"
    encoding: utf8mb4
    collation: utf8mb4_general_ci

mysql_users:
  - name: "{{ drupal_db_user }}"
    host: "%"
    password: "{{ drupal_db_password }}"
    priv: "{{ drupal_db_name }}.*:ALL"

# PostgreSQL databases and users.
postgresql_databases:
  - name: "{{ drupal_db_name }}"

postgresql_users:
  - name: "{{ drupal_db_user }}"
    password: "{{ drupal_db_password }}"
    db: "{{ drupal_db_name }}"
    priv: "ALL"

# Comment out any extra utilities you don't want to install. If you don't want
# to install *any* extras, set this value to an empty set, e.g. `[]`.
installed_extras:
  - adminer
  # - blackfire
  - drupalconsole
  - drush
  # - elasticsearch
  # - java
  - mailhog
  # - memcached
  # - newrelic
  # - nodejs
  - pimpmylog
  # - redis
  # - ruby
  # - selenium
  # - solr
  # - tideways
  # - upload-progress
  - varnish
  # - xdebug
  # - xhprof

# Add any extra apt or yum packages you would like installed.
extra_packages:
  - sqlite
  - libapache2-mod-php7.0

# You can configure almost anything else on the server in the rest of this file.
extra_security_enabled: false

drush_version: "8.x"
drush_keep_updated: true
drush_composer_cli_options: "--prefer-dist --no-interaction"

firewall_allowed_tcp_ports:
  - "22"
  - "25"
  - "80"
  - "81"
  - "443"
  - "4444"
  - "8025"
  - "8080"
  - "8443"
  - "8983"
  - "9200"
firewall_log_dropped_packets: false
firewall_disable_firewalld: true
firewall_disable_ufw: true

# PHP Configuration. Currently-supported versions: 5.6, 7.0, 7.1.
# See version-specific notes: http://docs.drupalvm.com/en/latest/configurations/php/
php_version: "7.0"
php_install_recommends: no
php_memory_limit: "192M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/opt/mailhog/mhsendmail"
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "192"
php_opcache_max_accelerated_files: 4096
php_max_input_vars: "4000"
php_packages:
  - php7.0-soap

# Drupal VM defaults to using PHP-FPM with either Apache or Nginx. If you wish
# to instead use Apache + mod_php with an Ubuntu base box, make sure you add
# libapache2-mod-php7.0 to `extra_packages` elsewhere in this config file.
php_enable_php_fpm: false
php_fpm_listen: "127.0.0.1:9000"

composer_path: /usr/bin/composer
composer_home_path: "/home/{{ drupalvm_user }}/.composer"
composer_home_owner: "{{ drupalvm_user }}"
composer_home_group: "{{ drupalvm_user }}"
composer_global_packages:
  - { name: hirak/prestissimo, release: '^0.3' }

# Run specified scripts before or after VM is provisioned. Path is relative to
# the `provisioning/playbook.yml` file.
pre_provision_scripts: []
post_provision_scripts: []
  # - "../examples/scripts/configure-solr.sh"

# MySQL Configuration.
mysql_root_password: root
mysql_slow_query_log_enabled: true
mysql_slow_query_time: 2
mysql_wait_timeout: 300
adminer_install_filename: index.php

# Node.js configuration (if enabled above).
# Valid examples: "0.10", "0.12", "4.x", "5.x".
nodejs_version: "0.12"
nodejs_npm_global_packages: []
nodejs_install_npm_user: "{{ drupalvm_user }}"
npm_config_prefix: "/home/{{ drupalvm_user }}/.npm-global"

# Ruby Configuration (if enabled above).
ruby_install_gems_user: "{{ drupalvm_user }}"
ruby_install_gems: []

# Varnish Configuration (if enabled above).
varnish_listen_port: "81"
varnish_default_vcl_template_path: templates/drupalvm.vcl.j2
varnish_default_backend_host: "127.0.0.1"
varnish_default_backend_port: "80"

# Pimp my Log settings.
pimpmylog_install_dir: /usr/share/php/pimpmylog
pimpmylog_grant_all_privs: true

# XDebug configuration. XDebug is disabled by default for better performance.
php_xdebug_default_enable: 1
php_xdebug_coverage_enable: 1
php_xdebug_cli_enable: 1
php_xdebug_remote_enable: 1
php_xdebug_remote_connect_back: 1
# Use PHPSTORM for PHPStorm, sublime.xdebug for Sublime Text.
php_xdebug_idekey: PHPSTORM
php_xdebug_max_nesting_level: 256

# Solr Configuration (if enabled above).
solr_version: "5.5.3"
solr_xms: "64M"
solr_xmx: "128M"

# Selenium configuration.
selenium_version: 2.53.0

# Other configuration.
dashboard_install_dir: /var/www/dashboard
known_hosts_path: ~/.ssh/known_hosts
#ssh_home: "{{ drupal_core_path }}"

Any suggestions?

Thanks!

composer fails to run with "/usr/bin/env: php: No such file or directory" when using custom php_executable

I am using current latest geerlingguy.repo-remi , geerlingguy.php and geerlingguy.composer on Centos 7.

What I am trying to do is install PHP 7.3 and composer.

My group_vars/all.yml:

---
php_enablerepo: "remi-php73"

php_packages:
  - php73-php
  - php73-php-cli
  - php73-php-devel
  - php73-php-pdo
  - php73-php-mbstring
  - php73-php-json
  - php73-php-xml
  - php73-php-pgsql

composer_keep_updated: false
composer_version: '1.9.3'
php_executable: php73

My site.yml:

---
- hosts: all
  roles:
    - geerlingguy.repo-remi
    - geerlingguy.php
    - geerlingguy.composer

Ansible playbook passes correctly but when I try to run composer it fails with:

[root@localhost ~]# composer
/usr/bin/env: php: No such file or directory

..obviously, because:

[root@localhost ~]# head -n1 /usr/local/bin/composer
#!/usr/bin/env php

..and because there is no php binary or a symlink on my system:

[root@localhost ~]# php
bash: php: command not found

I will try to go ahead for now by creating a symlink for php -> php73 but I am not sure if this will not run me into more trouble in the future so I would appreciate a suggestion what is the right solution here.

Composer Installer Fails

Env:

  • CentOS Linux release 7.5.1804 (Core)
  • Ansible 2.6.1

More info:

  • Run on startup of initial centos image. Problem does not occur when run manually outside of a deployment.

TASK [geerlingguy.composer : Run Composer installer.] **************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["php", "composer-installer.php"], "delta": "0:00:00.024589", "end": "2018-07-26 00:34:06.510243", "msg": "non-zero return code", "rc": 1, "start": "2018-07-26 00:34:06.485654", "stderr": "", "stderr_lines": [], "stdout": "All settings correct for using Composer\nThe HOME or COMPOSER_HOME environment variable must be set for composer to run correctly", "stdout_lines": ["All settings correct for using Composer", "The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly"]}

include: deprecated

[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 'import_tasks' for static inclusions or
'include_tasks' for dynamic inclusions. This feature will be removed in a future release. Deprecation warnings can be
disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is discouraged. The module documentation details
 page may explain more about this rationale.. This feature will be removed in a future release. Deprecation warnings can be
disabled by setting deprecation_warnings=False in ansible.cfg.

- include: global-require.yml

- include: project-bin.yml

Composer Path Web User

Trying to set up composer so I can use my web user to install Laravel. So I added

composer_home_path: '/home/web/.composer'
composer_home_owner: web
composer_home_group: www-data
composer_add_to_path: true

but composer does not get added to the web user's path:

web@Laravel:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

When I only added

composer_global_packages: 
  - { name: laravel/installer }

it did get added to the root user path:

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/root/.composer/vendor/bin

I only thought it would get added to the system path as stated in the readme:

If true, and if there are any configured composer_global_packages, the vendor/bin directory inside composer_home_path will be added to the system's default $PATH (for all users).
When I check what I think is the Ubuntu 17.0.4 system default path I saw no composer added either

cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

I must be missing something..

Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user

Vars:

application_user: test_user
composer_home_path: '~/.composer'
composer_home_owner: test_user
composer_home_group: test_user
composer_global_packages:
 - { name: gordalina/cachetool }

Playbook:

---
- name: Add application user - {{application_user}}
  user: name={{application_user}} groups=www-data state=present
- name: Install Composer
  import_role:
    name: geerlingguy.composer

TASK [geerlingguy.composer : Install configured globally-required packages.] *****************************************************************************************************************************************************
fatal: [kochan_vm_20_3c]: FAILED! => {"msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: chown: changing ownership of '/var/tmp/ansible-tmp-1600936221.55-31066-138531225095947/': Operation not permitted\nchown: changing ownership of '/var/tmp/ansible-tmp-1600936221.55-31066-138531225095947/AnsiballZ_command.py': Operation not permitted\n}). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}
ansible 2.9.12
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/kochan/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.18rc1 (default, Apr  7 2020, 12:05:55) [GCC 9.3.0]

composer_global_packages hangs after each package operation

Specifying composer_global_packages causes Ansible to hang after each package, even though package installation succeeds. If N global packages are specified, Ansible has to be re-run N times to complete the task. However, even though the task subsequently "completes", it does not actually install anything, it just creates the project folders, e.g. ~/.composer/vendor/hirak/prestissimo, but those folders remain empty.

Example

- name: Composer
  import_role: name=geerlingguy.composer
  vars:
    composer_home_path: /home/bilge/.composer
    composer_home_owner: bilge
    composer_home_group: bilge
    composer_global_packages:
      - { name: hirak/prestissimo }
      - { name: d11wtq/boris }
  tags: composer

Target machine

Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial

Download/Install fails with SSL-Error

If for some reason the package ca-certificates is not present on Debian Linux, the download or install of Composer fails with an SSL error.

It took me awhile to get to the main problem.

This fixes the problem:

- name: Add certs
  apt: name="ca-certificates" state="present"

Default composer_home_owner as ansible_ssh_user

There are a few issues with this:

  • We can't really use become as the path might not be writable by the user
  • If we use file modules chown ability the default path of ~/.composer would become /root/.composer
  • Using /home/{{ composer_home_owner }} isnt really reliable in the case of root or osx.
  • If we use file modules chown ability we do not know the users primary group (on unix we can assume it's the same as the users name but someone might run this on osx too)

So we either:

  1. Remove the default variable values and use two shell commands to figure out $HOME as well as $GROUP and then set them as facts if not previously defined.
  2. We use become and do not support paths which are not writable by the user

Vagrant up is causing "Failed to download the file"

I'm trying to install Trellis on my computer after runs vagrant up I get this error:

default: Running ansible-galaxy...
- downloading role 'composer', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-composer/archive/1.6.1.tar.gz
 [ERROR]: failed to download the file: Failed to validate the SSL certificate
for github.com:443. Make sure your managed systems have a valid CA certificate
installed. You can use validate_certs=False if you do not need to confirm the
servers identity but this is unsafe and not recommended. Paths checked for this
platform: /etc/ssl/certs, /etc/ansible, /usr/local/etc/openssl

 [WARNING]: - composer was NOT installed successfully.

ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Searching about this problem I found this and this topic but none have a workaround to fix it. Any idea what is causing the problem?

How do I override php_executable?

Sorry for my ignorance, but I have tried to override this variable in a half-dozen different places and it is not working.

Here is my composer task (roles/deploy/tasks/build.yml)

- name: Install Composer dependencies
  composer:
    no_scripts: yes
    working_dir: "{{ deploy_helper.new_release_path }}"
  become: true

I have tried setting the variable in roles/deploy/vars/main.yml, roles/deploy/defaults/main.yml, group_vars/staging/main.yml, group_vars/all/main.yml, and all created a task to set_fact immediately before the above task. None of these seem to override the default of 'php'. I am definitely fairly new to ansible, but after reading and re-reading the variables documentation I have to believe setting it one of those places should have worked?

Store Github OAuth token

I saw in one of the composer roles the possibility to store github oauth token, so that if composer installation is part of your set up/provision, it won't fail because of Github API Rate limit.

Composer home directory creation fails if ~ is not writable by composer_home_owner

I’m running the role with composer_home_owner=www-data and composer_home_group=www-data.

The task that creates composer_home_path uses become_user: "{{ composer_home_owner }}", but in my case /var/www, www-data’s home directory, is owner by root and so www-data can’t create /var/www/.composer. The solution would be to remove the become_user attribute, but then the tilde resolution would fail (#68).

I’m not sure how to fix the issue. My workaround is to create /var/www/.composer by myself before invoking the role.

Use get_url instead of curl - warning in Ansible 2.0.0

TASK [geerlingguy.composer | Install Composer into the current directory.] ****************************
changed: [default]
 [WARNING]: Consider using get_url module rather than running curl

Says it all. I could just download the composer.phar directly, but I still think it's more universally compatible to install the phar using Composer's installer. I can add an extra step to run the installation locally.

Disable: Add composer_home_path bin directory to global $PATH.

Is it possible to optional dismiss

Add composer_home_path bin directory to global $PATH.

we have this already defined in the user $PATH in .zshrc, so we don't want to give our ansible root permissions to execute something which we don't really need.

Optionally add COMPOSER_HOME/vendor/bin to global $PATH

Adding the following inside /etc/profile.d/composer.sh will add the COMPOSER_HOME/vendor/bin path to all users' PATHs on the system. This should make setup for global require'd packages simpler, so the user doesn't have to do the path modification himself.

Request for cgr support

With dependences possibly conflicting (see error below) it would be nice to have a flag that switches to cgr from composer global require.

An article on why composer global require can be harmful
https://www.sitepoint.com/composer-global-require-considered-harmful/

Link to the package.
https://packagist.org/packages/consolidation/cgr

failed: [42.42.42.42] ... 
Problem 1\n    - Installation request for drush/drush 8.1 -> satisfiable by drush/drush[8.1.0].\n    - Conclusion: remove symfony/console v3.4.4\n    
- Conclusion: don't install symfony/console v3.4.4\n    
- drush/drush 8.1.0 requires symfony/console ~2.7 -> satisfiable by symfony/console[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.3.....

My current issue is solved by using geerlingguy/ansible-role-drush for global drush.

composer_version documentation should specify to nullify composer_version_branch

Composer recently released version 2.2 which includes BC breaking changes. However, limiting the version with composer_version doesn't seem to do anything.

My specific configuration:

composer_version: '2.1.14'

What I get when I run composer --version:

root@ansible-testing-2022-brandon:~# composer --version
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Composer version 2.2.3 2021-12-31 12:18:53

composer home path is .config/composer

I am working with this role and your drush role. Composer is installed fine and when running the drush install it works as well but fails when it is trying to symlink drush to the bin folder.
The drush symlink is hard coded to ~/.composer/vendor/... while it ends up being ~/.config/composer/vendor/...
https://github.com/geerlingguy/ansible-role-drush/blob/30ba8f04c8f438a41a820338c90dc4a5b67f8506/tasks/install-drush-composer.yml#L21

The quick fix is to add the config/ in the drush role but since there is a variable for composer_home_path set to ~/.composer and it is not respected I decided to put the issue here.
composer_home_path: '~/.composer'

composer_home_path: '~/.composer'

SHA384 is not supported by your openssl extension

FAILED! => {"changed": true, "cmd": ["php", "/usr/local/bin/composer", "self-update"], "delta": "0:00:01.609223", "end": "2018-11-05 20:28:16.092391", "msg": "non-zero return code", "rc": 1, "start": "2018-11-05 20:28:14.483168", "stderr": "   Downloading (connecting...)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bDownloading (100%)         \b\b\b\b\b\b\b\b\b\n\n                                                                                               \n  [RuntimeException]                                                                           \n  SHA384 is not supported by your openssl extension, could not verify the phar file integrity  \n
ansible-galaxy install geerlingguy.composer,1.7.3 -p roles/ --force

Issue exists on composer side. Not sure how to fix.

composer/composer#7649

ansible-lint complains about global-require.yml

[ANSIBLE0014] Environment variables don't work as part of command
/m/ansible/roles/geerlingguy.composer/tasks/global-require.yml:2
Task/Handler: Install configured globally-required packages.

[ANSIBLE0013] Use shell only when shell functionality is required
/m/ansible/roles/geerlingguy.composer/tasks/global-require.yml:2
Task/Handler: Install configured globally-required packages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.