Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create project_shared_children files if they do not exist #706

Merged
merged 3 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Create `project_shared_children` files if they do not exist ([#706](https://github.com/roots/trellis/pull/706))
* Diffie-Hellman params now conditional on SSL status ([#709](https://github.com/roots/trellis/pull/709))
* Update PHP to 7.1 ([#695](https://github.com/roots/trellis/pull/695))
* Update WP-CLI to 1.0.0 ([#708](https://github.com/roots/trellis/pull/708))
Expand Down
10 changes: 5 additions & 5 deletions roles/deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ project_templates:
src: roles/deploy/templates/env.j2
dest: .env

# The shared_children is a list of all files/folders in your project that need to be linked to a path in "/shared".
# The shared_children is a list of all files/folders in your project that need to be linked to a path in `/shared`.
# For example a sessions directory or an uploads folder. They are created if they don't exist, with the type
# specified in the `type` key (file or directory).
# Example:
# project_shared_children:
# - path: "app/sessions"
# src: "sessions"
# mode: "0755"
# type: "file" / "directory" // <- optional, defaults to "directory"
# - path: app/sessions
# src: sessions
# mode: '0755' // <- optional, must be quoted, defaults to `'0755'` if `directory` or `'0644'` if `file`
# type: directory // <- optional, defaults to `directory`, options: `directory` or `file`
project_shared_children:
- path: web/app/uploads
src: uploads
Expand Down
27 changes: 25 additions & 2 deletions roles/deploy/tasks/share.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,35 @@
- include: "{{ deploy_share_before | default('../hooks/example.yml') }}"
tags: deploy-share-before

- name: Ensure shared sources are present
- name: Ensure shared sources are present -- directories
file:
path: "{{ deploy_helper.shared_path }}/{{ item.src }}"
state: "{{ item.type | default('directory') }}"
state: directory
mode: "{{ item.mode | default('0755') }}"
with_items: "{{ project_shared_children }}"
when: item.type | default('directory') | lower == 'directory'

- name: Ensure shared sources are present -- files' parent directories
file:
path: "{{ deploy_helper.shared_path }}/{{ item.src | dirname }}"
state: directory
mode: '0755'
with_items: "{{ project_shared_children }}"
when: item.type | default('directory') | lower == 'file'

- name: Ensure shared sources are present -- files
file:
path: "{{ deploy_helper.shared_path }}/{{ item.src }}"
state: touch
mode: "{{ item.mode | default('0644') }}"
with_items: "{{ project_shared_children }}"
when: item.type | default('directory') | lower == 'file'

- name: Ensure parent directories for shared paths are present
file:
path: "{{ deploy_helper.new_release_path }}/{{ item.path | dirname }}"
state: directory
with_items: "{{ project_shared_children }}"

- name: Ensure shared paths are absent
file:
Expand Down