This commit is contained in:
2023-12-24 18:48:38 +01:00
parent f1c912924e
commit bc086d5236
4 changed files with 155 additions and 11 deletions

View File

@@ -2,21 +2,40 @@
- name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml
- name: "create {{ repository_directory }}"
file:
path: "{{ repository_directory }}"
state: directory
mode: 0755
- name: register repository_directory_register
stat:
path: "{{repository_directory}}"
register: repository_directory_register
- name: checkout repository
ansible.builtin.shell: git checkout .
become: true
args:
chdir: "{{repository_directory}}"
when: repository_directory_register.stat.exists
- name: "backup docker-compose.yml if it exists"
command: >
mv "{{ docker_compose_file_path }}" "{{ docker_compose_backup_path }}"
args:
removes: "{{ docker_compose_file_path }}"
become: true
- name: pull docker repository
git:
repo: "https://github.com/opf/openproject-deploy"
dest: "{{repository_directory}}"
dest: "{{ repository_directory }}"
update: yes
notify: recreate openproject
become: true
register: git_result
ignore_errors: true
- name: "restore docker-compose.yml from backup"
command: >
mv "{{ docker_compose_backup_path }}" "{{ docker_compose_file_path }}"
args:
removes: "{{ docker_compose_backup_path }}"
become: true
- name: Warn if repo is not reachable
debug:
@@ -26,5 +45,11 @@
- name: "copy .env"
template:
src: env.j2
dest: "{{docker_compose_instance_directory}}.env"
notify: recreate openproject
dest: "{{ docker_compose_instance_directory }}.env"
notify: recreate openproject
- name: "copy docker-compose.yml"
template:
src: docker-compose.yml.j2
dest: "{{ docker_compose_file_path }}"
notify: recreate openproject