Skip to content
Snippets Groups Projects
Commit 361b1e6b authored by Simon Constans's avatar Simon Constans
Browse files

Initial commit

parents
No related branches found
Tags v1.5.0
No related merge requests found
tests/.vagrant
language: python
python:
- 2.7
install:
- pip install ansible==1.4.0
script:
- cd tests
- ansible-playbook -i inventory playbook.yml --syntax-check
- ansible-playbook -i inventory playbook.yml --connection=local --sudo
- >
ansible-playbook -i inventory playbook.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# ansible-role-composer
[![Build Status](https://travis-ci.org/kosssi/ansible-role-composer.svg?branch=master)](https://travis-ci.org/kosssi/ansible-role-composer)
Installs Composer, the PHP Dependency Manager.
## Requirements
- php (version 5.3+) should be installed.
## Role Defaults Variables
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.
## Example Playbook
roles:
- { role: kosssi.composer }
## License
MIT
composer_path: /usr/local/bin/composer
composer_update: true
composer_update_day: 20
galaxy_info:
author: kosssi
description: Install and Update Composer PHP Dependency Manager
license: license MIT
min_ansible_version: 1.4
platforms:
- name: Ubuntu
versions:
- all
- name: Debian
versions:
- all
categories:
- packaging
- web
- php
- composer
- name: Download and install Composer into the current directory.
shell:
php -r "readfile('https://getcomposer.org/installer');" | php
creates={{ composer_path }}
- name: Move Composer into bin directory.
shell:
mv composer.phar {{ composer_path }}
creates={{ composer_path }}
- include: install.yml
- include: test.yml
- include: update.yml
when: composer_update == true
\ No newline at end of file
- name: Get stat of composer file
stat:
path="{{ composer_path }}"
register: composer_stat
- name: Test if composer file exist
fail:
msg="{{ composer_path }} isn't exist"
when: composer_stat.stat.exists == false
- name: Get date for composer update
shell:
date --date="{{ composer_update_day }} days ago" +"%s"
register: composer_date
changed_when: False
- name: Update composer if necessary
shell:
"{{ composer_path }} selfupdate"
when: composer_date.stdout|int > composer_stat.stat.mtime|int
test_ubuntu-14.04:
VM_BOX='ubuntu/trusty64' vagrant up
VM_BOX='ubuntu/trusty64' vagrant provision
VM_BOX='ubuntu/trusty64' vagrant destroy -f
test_ubuntu-12.04:
VM_BOX='hashicorp/precise64' vagrant up
VM_BOX='hashicorp/precise64' vagrant provision
VM_BOX='hashicorp/precise64' vagrant destroy -f
$VM_BOX = ENV.has_key?('VM_BOX') ? ENV['VM_BOX'] : 'ubuntu/trusty64'
Vagrant.configure('2') do |config|
config.vm.box = $VM_BOX
config.vm.provision :ansible do |ansible|
ansible.playbook = 'playbook.yml'
ansible.extra_vars = { ansible_ssh_user: 'vagrant', vagrant: true }
ansible.verbose = 'v'
end
end
localhost
- hosts: all
sudo: true
roles:
- { role: common, tags: apt }
- { role: ../../ansible-role-composer, tags: composer }
- name: Update Apt cache
apt:
update_cache=yes
cache_valid_time=3600
- name: Install php packages
apt:
pkg=php5
state=present
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment