kovalhome/infra/cloud/0003_app_playbook.yaml

29 lines
671 B
YAML

- name: Deploy app
hosts: cloud
gather_facts: false
vars:
project: cloud
tasks:
- name: Wait for connection
ansible.builtin.wait_for_connection:
timeout: 300
- name: Get user
ansible.builtin.user:
name: debian
register: user
- name: Copy project
ansible.builtin.copy:
src: ./{{ project }}
dest: "{{ user.home }}"
mode: "0744"
notify: re-deploy
handlers:
- name: Restart Docker compose
ansible.builtin.shell: |
docker compose down
docker compose up -d
exit 0
args:
chdir: "{{ user.home }}/{{ project }}"
listen: re-deploy