Skip to content

Commit 23c1df8

Browse files
author
Marc Aschmann
committed
Merge branch 'maschmann-cleanup-and-introduction-of-item-iterator'
2 parents df78d6a + 278b233 commit 23c1df8

File tree

4 files changed

+60
-24
lines changed

4 files changed

+60
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
## v0.1
4+
5+
* structural refactoring (creating files, directories, ...)
6+
* added cleanup-script to remove old releases

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ Role Variables
4141
symfony2_project_env: prod
4242
symfony2_project_console_opts: ''
4343
symfony2_project_composer_opts: '--no-dev --optimize-autoloader'
44+
<<<<<<< HEAD
4445
symfony2_project_keep_releases: 5
46+
=======
47+
symfony2_project_clean_versioning: true
48+
>>>>>>> 86069b4780bce7951c4324a6312b1d99b37fa6e8
4549
```
4650

4751
Dependencies

defaults/main.yml

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

tasks/main.yml

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
11
---
22
# tasks file for symfony2
3-
- name: Create the release {{symfony2_project_release}} directory.
4-
file: state=directory path={{symfony2_project_root}}/releases/{{symfony2_project_release}}
5-
- name: Create the shared directory.
6-
file: state=directory path={{symfony2_project_root}}/shared
7-
- name: Create the shared/app/config directory.
8-
file: state=directory path={{symfony2_project_root}}/shared/app/config
9-
- name: Create the shared/web/uploads directory.
10-
file: state=directory path={{symfony2_project_root}}/shared/web/uploads
11-
- name: Create the shared/app/logs directory.
12-
file: state=directory path={{symfony2_project_root}}/shared/app/logs
3+
- name: Create/prepare directories for release and shared data.
4+
file: state=directory path={{item.path}}
5+
with_items:
6+
- { path: "{{symfony2_project_root}}/releases/{{symfony2_project_release}}" }
7+
- { path: "{{symfony2_project_root}}/shared" }
8+
- { path: "{{symfony2_project_root}}/shared/app/config" }
9+
- { path: "{{symfony2_project_root}}/shared/app/uploads" }
10+
- { path: "{{symfony2_project_root}}/shared/app/logs" }
11+
1312
- name: Pull sources from the repository.
14-
git: repo={{symfony2_project_repo}} dest={{symfony2_project_root}}/releases/{{symfony2_project_release}} version={{symfony2_project_branch}}
15-
- name: Check if shared/app/config/parameters.ini exists
13+
git: repo={{symfony2_project_repo}} dest={{symfony2_project_root}}/releases/{{symfony2_project_release}} version={{symfony2_project_branch}} accept_hostkey=yes
14+
15+
- name: Clean out versioning.
16+
file: state=absent path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/.git
17+
when: symfony2_project_clean_versioning == true
18+
19+
- name: Create symlinks to shared directories.
20+
file: state=link src={{item.src}} path={{item.path}}
21+
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" }
24+
25+
- name: Check if shared/app/config/parameters.ini exists.
1626
stat: path={{symfony2_project_root}}/shared/app/config/parameters.ini
1727
register: parameters_ini
18-
- name: Create symlink for app/config/parameters.ini from shared directory
28+
29+
- name: Create symlink for app/config/parameters.ini from shared directory.
1930
shell: ln -s {{symfony2_project_root}}/shared/app/config/parameters.ini {{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/config/parameters.ini creates={{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/config/parameters.ini
2031
when: parameters_ini.stat.exists
21-
- name: Create app/logs symlink
22-
file: state=link src={{symfony2_project_root}}/shared/app/logs path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/app/logs
23-
- name: Create web/uploads symlink
24-
file: state=link src={{symfony2_project_root}}/shared/web/uploads path={{symfony2_project_root}}/releases/{{symfony2_project_release}}/web/uploads
25-
- name: Install composer
26-
get_url: url=https://getcomposer.org/composer.phar dest={{symfony2_project_root}}/composer.phar mode=0755 validate_certs=no
27-
- name: Run composer install
28-
shell: cd {{symfony2_project_root}}/releases/{{symfony2_project_release}} && export SYMFONY_ENV={{symfony2_project_env}}; {{symfony2_project_php_path}} {{symfony2_project_root}}/composer.phar install {{symfony2_project_composer_opts}}
29-
- name: Dump assets
32+
33+
- name: Check if composer exists.
34+
stat: path={{symfony2_project_composer_path}}
35+
register: composer_file
36+
37+
- name: Install composer.
38+
get_url: url=https://getcomposer.org/composer.phar dest={{symfony2_project_composer_path}} mode=0755 validate_certs=no
39+
when: composer_file.stat.exists == false
40+
41+
- name: Update composer if already exists.
42+
shell: "{{symfony2_project_composer_path}} selfupdate"
43+
when: composer_file.stat.exists == true
44+
45+
- 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}}
47+
48+
- name: Dump assets.
3049
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}}
31-
- name: Run migrations
50+
51+
- name: Run migrations.
3252
shell: cd {{symfony2_project_root}}/releases/{{symfony2_project_release}} && if $(grep doctrine-migrations-bundle composer.json); then {{symfony2_project_php_path}} app/console doctrine:migrations:migrate -n; fi
33-
- name: Create symlink
53+
54+
- name: Create symlink.
3455
file: state=link src={{symfony2_project_root}}/releases/{{symfony2_project_release}} path={{symfony2_project_root}}/current
56+
3557
- name: Cleanup releases.
3658
shell: cd {{symfony2_project_root}}/releases && ls -t1 | tail -n +$(({{symfony2_project_keep_releases}}+1)) | xargs -n1 rm -rf

0 commit comments

Comments
 (0)