Skip to content

Commit

Permalink
added composer run paths
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed May 15, 2015
1 parent e8bbb09 commit 321ffdd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
>
> * installs composer
> * updates composer
> * runs composer on given paths
## Installation

Expand All @@ -27,18 +28,32 @@ Using `requirements.yml`:
Using `git`:

```
$ git clone https://github.com/weareinteractive/ansible-composer.git
$ git clone https://github.com/weareinteractive/ansible-composer.git franklinkim.composer
```

## Variables

Here is a list of all the default variables for this role, which are also available in `defaults/main.yml`.

```
# composer_paths:
# - /var/www/foo
# - command: ...
# no_dev: ...
# no_plugins: ...
# no_scripts: ...
# optimize_autoloader: ...
# prefer_dist: ...
# prefer_source: ...
# working_dir: /var/www/bar
#
# days till next update
composer_update_day: 20
# path to install composer to
composer_path: /usr/local/bin
# list of paths to run composer (@see http://docs.ansible.com/composer_module.html)
composer_paths: []
```

## Example playbook
Expand All @@ -55,6 +70,10 @@ composer_path: /usr/local/bin
- { section: PHP, option: default_charset, value: UTF-8 }
- { section: Date, option: date.timezone, value: Europe/Berlin }
- { section: PHP, option: error_log, value: /var/log/php5/error-cli.log }
composer_paths:
- /var/www/foo
- working_dir: /var/www/bar
command: update
```

## Testing
Expand Down
14 changes: 14 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
---
# For more information about default variables see:
# http://www.ansibleworks.com/docs/playbooks_variables.html#id26
#
# composer_paths:
# - /var/www/foo
# - command: ...
# no_dev: ...
# no_plugins: ...
# no_scripts: ...
# optimize_autoloader: ...
# prefer_dist: ...
# prefer_source: ...
# working_dir: /var/www/bar
#

# days till next update
composer_update_day: 20
# path to install composer to
composer_path: /usr/local/bin
# list of paths to run composer (@see http://docs.ansible.com/composer_module.html)
composer_paths: []
6 changes: 4 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
tags:
- web
- composer
- manage
- composer-install

- include: update.yml
- include: manage.yml
tags:
- web
- composer
- composer-update
- manage
- composer-manage
13 changes: 13 additions & 0 deletions tasks/manage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

- name: Managing composer
composer:
command: "{{ item.command | default(omit) }}"
no_dev: "{{ item.no_dev | default(omit) }}"
no_plugins: "{{ item.no_plugins | default(omit) }}"
no_scripts: "{{ item.no_scripts | default(omit) }}"
optimize_autoloader: "{{ item.optimize_autoloader | default(omit) }}"
prefer_dist: "{{ item.prefer_dist | default(omit) }}"
prefer_source: "{{ item.prefer_source | default(omit) }}"
working_dir: "{{ item.working_dir if item.working_dir is defined else item }}"
with_items: composer_paths

0 comments on commit 321ffdd

Please sign in to comment.