homeserver/roles/mgrote.docker-compose-deploy/tasks/dockercompose.yml
mg fc0657747d Bugfix: git stash (#157)
Bugfix: git stash

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#157
Co-Authored-By: mg <mg@noreply.git.mgrote.net>
Co-Committed-By: mg <mg@noreply.git.mgrote.net>
2021-07-16 12:43:31 +02:00

24 lines
832 B
YAML

---
- name: check if repo exists
stat:
path: "{{ docker_compose_base_dir }}/{{ item.dir_name }}"
register: repo_exists
- name: stash changes
ansible.builtin.shell: git stash
args:
chdir: "{{ docker_compose_base_dir }}/{{ item.dir_name }}"
changed_when: false
when: repo_exists.stat.exists == true
- name: clone public repository - "{{ item.name }}"
ansible.builtin.git:
repo: "https://{{ item.repository_user }}:{{ item.repository_user_password }}@{{ item.repository_url }}"
dest: "{{ docker_compose_base_dir }}/{{ item.dir_name }}"
register: repo
- name: (re)start container - "{{ item.name }}"
ansible.builtin.shell: docker-compose down && docker-compose up -d
args:
chdir: "{{ docker_compose_base_dir }}/{{ item.dir_name }}"
when: repo.changed