ansible/deploy.yaml
---
- name: copy prod env
import_playbook: copy_prod_env.yaml
- name: do the deploy
hosts: localhost
vars:
- deployhost: "{{ ENV | upper }}_SERVER_IP"
tasks:
- name: checkout latest
git:
repo: https://github.com/emory-libraries/dlp-selfdeposit
dest: files/checkout
version: main
- name: get ec2host ip
ec2_instance_info:
filters:
"tag:Name": OE24-hyrax-{{ ENV }}
register: instance_ip
- name: bundle install
shell:
cmd: bundle install
chdir: files/checkout
args:
executable: /bin/bash
- name: add to .bash_profile
lineinfile:
name: ~/.bash_profile
line: "export {{ deployhost }}={{ instance_ip.instances[0].network_interfaces[0].private_ip_address }} "
- name: deploy
shell:
cmd: source ~/.bash_profile && BRANCH=main bundle exec cap "{{ ENV }}" deploy
chdir: files/checkout
args:
executable: /bin/bash
register: errors
ignore_errors: yes
- name: print deploy results
debug:
msg: "{{ errors }}"
- name: delete env file to make sure we don't git commit it
file:
path: files/env_to_deploy
state: absent