30 lines
752 B
YAML
30 lines
752 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"
|
|
- name: Docker compose
|
|
module_defaults:
|
|
community.docker.docker_compose:
|
|
project_src: "{{ user.home }}/{{ project }}"
|
|
block:
|
|
- name: Down
|
|
community.docker.docker_compose:
|
|
state: absent
|
|
- name: Up
|
|
community.docker.docker_compose:
|
|
state: present
|