-
-
Save rossbulat/e907790823b35834114eed645b9dcf93 to your computer and use it in GitHub Desktop.
Ansible Github Deployment Playbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Github -> Production Deployment | |
# | |
# Change vars to point to your own folders | |
# These folders should exist on your production servers | |
--- | |
- name: React App Deployment from Github Repository | |
connection: ssh | |
gather_facts: false | |
hosts: all | |
vars: | |
repo_folder: /var/deployment/repos/repository-name | |
live_folder: /var/deployment/mydomain.com/build | |
repo_name: username/repository-name | |
tasks: | |
- git: | |
repo: ssh://git@github.com/{{ repo_name }}.git | |
dest: "{{ repo_folder }}" | |
update: yes | |
- name: Install dependencies | |
yarn: | |
path: "{{ repo_folder }}" | |
- name: Build project | |
command: yarn build | |
args: | |
chdir: "{{ repo_folder }}" | |
- name: Copy build to live directory | |
command: cp -TRv build {{ live_folder }} | |
args: | |
chdir: "{{ repo_folder }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment