Hi I've been trying to make ansible run composer install to install all the content in my composer.json inside my laravel file. But I'm getting this error ERROR: composer is not a legal parameter in an Ansible task or handler I'm not sure what's causing this. Below are the content of my playbook.
---
- name: Install PHP5+
apt: name={{ item }} update_cache=yes state=latest
with_items:
- git
- mcrypt
- php5-cli
- php5-curl
- php5-fpm
- php5-intl
- php5-json
- php5-mcrypt
- php5-sqlite
- sqlite3
notify:
- Reload Nginx
- name: install composer
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
args:
creates: /usr/local/bin/composer
- composer:
command: install
working_dir: /path/to/project
Now if I do vagrant provision I'm getting the Composer is not a legal parameter. Basically I just wanted to run composer and tell composer to install all dependency inside my composer json
I will usually just use a role from Ansible Galaxy, such as geerlingguy.composer for such requirements.
According to the Ansible Docs, the composer
module is available from Ansible 1.6, but requires composer to be pre-installed on the executable path.
Installing Composer is usually going to be a multi-step process, if you use the installer (from the geerlingguy.composer tasks/main.yml).
get_url
).Or, you can download the latest version, https://getcomposer.org/composer.phar or a tagged version make it executable and move it into an appropriate directory.