Skip to content

Commit b76dec3

Browse files
committed
Fixes for v0.2, added tests and .travis.yml
fixed merge errors fixed deployment issues with config if already exists in project fixed issue with missing SYMFONY_ENV while composer install fixed composer path variable missing added tests directory and travis.yml for testing
1 parent 23c1df8 commit b76dec3

File tree

8 files changed

+67
-22
lines changed

8 files changed

+67
-22
lines changed

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
language: python
3+
python: "2.7"
4+
5+
before_install:
6+
# Make sure everything's up to date.
7+
- sudo apt-get update -qq
8+
9+
install:
10+
# Install Ansible.
11+
- pip install ansible
12+
13+
# Add ansible.cfg to pick up roles path.
14+
- "printf '[defaults]\nroles_path = ../' > ansible.cfg"
15+
16+
script:
17+
# Check the role/playbook's syntax.
18+
- "ansible-playbook -i tests/inventory tests/test.yml --syntax-check"
19+
- "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v0.2
4+
* fixed merge errors
5+
* fixed deployment issues with config if already exists in project
6+
* fixed issue with missing SYMFONY_ENV while composer install
7+
* fixed composer path variable missing
8+
* added tests directory and travis.yml for testing
9+
310
## v0.1
411

512
* structural refactoring (creating files, directories, ...)

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,16 @@ Role Variables
3434
- vars:
3535
symfony2_project_root: Path where application will be deployed on server.
3636
symfony2_project_name: Name of project.
37+
symfony2_project_composer_path: path where composer.phar will be stored (e.g. project_root/shared)
3738
symfony2_project_repo: URL of git repository.
3839
symfony2_project_release: Release number, can be numeric, we recommend to set it to release date/time, 20140327100911
3940
symfony2_project_branch: git branch to deploy.
4041
symfony2_project_php_path: /usr/local/php54/bin/php
4142
symfony2_project_env: prod
4243
symfony2_project_console_opts: ''
4344
symfony2_project_composer_opts: '--no-dev --optimize-autoloader'
44-
<<<<<<< HEAD
4545
symfony2_project_keep_releases: 5
46-
=======
4746
symfony2_project_clean_versioning: true
48-
>>>>>>> 86069b4780bce7951c4324a6312b1d99b37fa6e8
4947
```
5048
5149
Dependencies

defaults/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
symfony2_project_release: 1
55
symfony2_project_branch: master
66
symfony2_project_php_path: php
7-
<<<<<<< HEAD
87
symfony2_project_keep_releases: 5
9-
=======
10-
symfony2_project_clean_versioning: true
11-
>>>>>>> 86069b4780bce7951c4324a6312b1d99b37fa6e8
8+
symfony2_project_clean_versioning: true

meta/main.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ galaxy_info:
33
author: servergrove
44
description:
55
company: ServerGrove
6-
# Some suggested licenses:
7-
# - BSD (default)
8-
# - MIT
9-
# - GPLv2
10-
# - GPLv3
11-
# - Apache
12-
# - CC-BY
136
license: MIT
147
min_ansible_version: 1.2
158
#
@@ -118,5 +111,4 @@ dependencies: []
118111
# List your role dependencies here, one per line. Only
119112
# dependencies available via galaxy should be listed here.
120113
# Be sure to remove the '[]' above if you add dependencies
121-
# to this list.
122-
114+
# to this list.

tasks/main.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
- { path: "{{symfony2_project_root}}/releases/{{symfony2_project_release}}" }
77
- { path: "{{symfony2_project_root}}/shared" }
88
- { path: "{{symfony2_project_root}}/shared/app/config" }
9-
- { path: "{{symfony2_project_root}}/shared/app/uploads" }
109
- { path: "{{symfony2_project_root}}/shared/app/logs" }
10+
- { path: "{{symfony2_project_root}}/shared/web/uploads" }
1111

1212
- name: Pull sources from the repository.
1313
git: repo={{symfony2_project_repo}} dest={{symfony2_project_root}}/releases/{{symfony2_project_release}} version={{symfony2_project_branch}} accept_hostkey=yes
@@ -16,11 +16,23 @@
1616
file: state=absent path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/.git
1717
when: symfony2_project_clean_versioning == true
1818

19+
# will be replaced with symlink
20+
- name: Ensure logs directory is not present.
21+
file: state=absent path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/logs
22+
1923
- name: Create symlinks to shared directories.
2024
file: state=link src={{item.src}} path={{item.path}}
2125
with_items:
22-
- { src: "{{symfony2_project_root}}/shared/web/uploads", path: "{{symfony2_project_root}}/releases/{{symfony2_project_release}}/uploads" }
23-
- { src: "{{symfony2_project_root}}/shared/app/logs", path: "{{symfony2_project_root}}/releases/{{symfony2_project_release}}/logs" }
26+
- { src: "{{symfony2_project_root}}/shared/app/logs", path: "{{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/logs" }
27+
- { src: "{{symfony2_project_root}}/shared/web/uploads", path: "{{symfony2_project_root}}/releases/{{symfony2_project_release}}/web/uploads" }
28+
29+
- name: Check if config dir exists.
30+
stat: path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/config
31+
register: config_dir
32+
33+
- name: Link configs dir if not yet exists.
34+
file: state=link src={{symfony2_project_root}}/shared/app/config path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/config
35+
when: config_dir.stat.exists == false
2436

2537
- name: Check if shared/app/config/parameters.ini exists.
2638
stat: path={{symfony2_project_root}}/shared/app/config/parameters.ini
@@ -31,19 +43,19 @@
3143
when: parameters_ini.stat.exists
3244

3345
- name: Check if composer exists.
34-
stat: path={{symfony2_project_composer_path}}
46+
stat: path={{symfony2_project_composer_path}}/composer.phar
3547
register: composer_file
3648

3749
- name: Install composer.
3850
get_url: url=https://getcomposer.org/composer.phar dest={{symfony2_project_composer_path}} mode=0755 validate_certs=no
3951
when: composer_file.stat.exists == false
4052

4153
- name: Update composer if already exists.
42-
shell: "{{symfony2_project_composer_path}} selfupdate"
54+
shell: "{{symfony2_project_composer_path}}/composer.phar selfupdate"
4355
when: composer_file.stat.exists == true
4456

4557
- name: Run composer install.
46-
shell: cd {{symfony2_project_root}}/releases/{{symfony2_project_release}} && {{symfony2_project_php_path}} {{symfony2_project_root}}/composer.phar install {{symfony2_project_composer_opts}}
58+
shell: cd {{symfony2_project_root}}/releases/{{symfony2_project_release}} && export SYMFONY_ENV={{symfony2_project_env}} && {{symfony2_project_php_path}} {{symfony2_project_composer_path}}/composer.phar install {{symfony2_project_composer_opts}}
4759

4860
- name: Dump assets.
4961
shell: cd {{symfony2_project_root}}/releases/{{symfony2_project_release}} && {{symfony2_project_php_path}} app/console assetic:dump --env={{symfony2_project_env}} {{symfony2_project_console_opts}}

tests/inventory

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost

tests/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
- hosts: localhost
3+
remote_user: root
4+
roles:
5+
- ansible-symfony2
6+
7+
vars:
8+
symfony2_project_root: ~/test_app
9+
symfony2_project_name: travis-test
10+
symfony2_project_composer_path: ~/test_app/shared
11+
symfony2_project_repo: [email protected]:symfony/symfony-standard.git
12+
symfony2_project_release: 1
13+
symfony2_project_branch: "2.6"
14+
symfony2_project_php_path: /usr/bin/php
15+
symfony2_project_env: prod
16+
symfony2_project_console_opts: '--no-debug'
17+
symfony2_project_composer_opts: '--no-dev --optimize-autoloader'
18+
symfony2_project_keep_releases: 5
19+
symfony2_project_clean_versioning: true

0 commit comments

Comments
 (0)