kovalhome/infra/cloud/0003_app_playbook.yaml

30 lines
752 B
YAML
Raw Normal View History

2023-09-25 23:40:09 +00:00
- name: Deploy app
hosts: cloud
gather_facts: false
vars:
2023-09-26 00:05:26 +00:00
project: cloud
2023-09-25 23:40:09 +00:00
tasks:
- name: Wait for connection
ansible.builtin.wait_for_connection:
timeout: 300
2023-09-26 00:05:26 +00:00
- name: Get user
ansible.builtin.user:
name: debian
register: user
2023-09-25 23:40:09 +00:00
- name: Copy project
ansible.builtin.copy:
2023-09-26 00:05:26 +00:00
src: ./{{ project }}
dest: "{{ user.home }}"
2023-09-26 00:20:36 +00:00
mode: "0744"
2023-09-26 00:05:26 +00:00
- 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