Skip to content

Instantly share code, notes, and snippets.

@cmosguy
Last active April 12, 2016 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmosguy/7e565335dd66962123f6cfcf70cbc4f3 to your computer and use it in GitHub Desktop.
Save cmosguy/7e565335dd66962123f6cfcf70cbc4f3 to your computer and use it in GitHub Desktop.
---
- 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 }}"
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: git@github.com/roots/bedrock.git)
More info:
> https://roots.io/trellis/docs/deploys/
when: project.repo is not defined or not project.repo | match("git@.*.git")
roles:
- deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment