forked from roots/trellis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
44 lines (39 loc) · 1.82 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
- include: variable-check.yml
vars:
playbook: deploy.yml
- name: Deploy WP site
hosts: web:&{{ env }}
remote_user: "{{ web_user }}"
vars:
deploy_build_before: "{{ playbook_dir }}/deploy-hooks/build-before.yml"
deploy_build_after: "{{ playbook_dir }}/roles/deploy/hooks/build-after.yml"
deploy_finalize_after: "{{ playbook_dir }}/roles/deploy/hooks/finalize-after.yml"
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
wordpress_env_defaults:
db_host: localhost
db_name: "{{ site | underscore }}_{{ env }}"
db_user: "{{ site | underscore }}"
disable_wp_cron: true
wp_env: "{{ env }}"
wp_home: "{{ project.ssl.enabled | default(false) | ternary('https', 'http') }}://{{ project.site_hosts | map(attribute='canonical') | first }}"
wp_siteurl: "{{ project.ssl.enabled | default(false) | ternary('https', 'http') }}://{{ project.site_hosts | map(attribute='canonical') | first }}/wp"
site_env: "{{ wordpress_env_defaults | combine(project.env | default({}), vault_wordpress_sites[site].env) }}"
pre_tasks:
- name: Ensure site is valid
connection: local
fail:
msg: "Site `{{ site | default('') }}` is not valid. Available sites to deploy: {{ wordpress_sites.keys() | join(', ') }}"
when: wordpress_sites[site | default('')] is not defined
- name: Ensure repo is valid
connection: local
fail:
msg: |
Invalid Git repository.
Ensure that your site's `repo` variable is defined in `group_vars/{{ env }}/wordpress_sites.yml` and uses the SSH format (example: [email protected]:roots/bedrock.git)
More info:
> https://roots.io/trellis/docs/deploys/
when: project.repo is not defined or not project.repo | match(".*@.*:.*\.git")
roles:
- deploy