wavedocs
2/14/2017 - 11:58 AM

aloha.yml

---

- name: Set timestamp
  set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"

- name: Set release path 
  set_fact: release_path="{{ app_path }}/releases/{{ timestamp }}"

- name: Remove old releases
  shell: "cd {{ app_path }}/releases && find ./ -maxdepth 1 | grep -G .............. | sort -r | tail -n +{{ keep_releases }} | xargs rm -rf"

- name: Create release directory
  file: path={{ release_path }} state=directory

- name: Upload the private key
  copy: src=event dest=/var/www/.ssh/event

- name: Correct SSH deploy key permissions
  file: dest=/var/www/.ssh/event mode=0600

- name: Checkout git repo into release directory
  git: repo={{ git_repo }} dest={{ release_path }} version={{ git_branch }} accept_hostkey=yes key_file=/var/www/.ssh/event force=yes recursive=no

- name: Rm symlink
  file: path={{ app_path }}/htdocs state=absent

- name: Create symlink
  file: src={{ release_path }} dest={{ app_path }}/htdocs state=link

- name: Create symlink wp-config.php
  file: src={{ app_path }}/shared/config/wp-config.php dest={{ app_path }}/htdocs/wp-config.php state=link