You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/webdav/tasks/main.yaml

75 lines
2.0 KiB
YAML

---
- name: "Send mattermost messsge"
uri:
url: "{{ mattermost_hook_smardigo }}"
method: POST
body: "{{ lookup('template','mattermost-deploy-start.json.j2') }}"
body_format: json
headers:
Content-Type: "application/json"
delegate_to: 127.0.0.1
become: false
when:
- send_status_messages
- name: "Check if webdav/docker-compose.yml exists"
stat:
path: '{{ service_base_path }}/{{ inventory_hostname }}/docker-compose.yml'
register: check_docker_compose_file
- name: "Stop webdav"
shell: docker-compose down
args:
chdir: '{{ service_base_path }}/{{ inventory_hostname }}'
when: check_docker_compose_file.stat.exists
ignore_errors: yes
- name: "Deploy docker templates for {{ inventory_hostname }}"
include_role:
name: _deploy
tasks_from: templates
vars:
current_config: "_docker"
current_base_path: "{{ service_base_path }}"
current_destination: "{{ inventory_hostname }}"
current_owner: "{{ docker_owner }}"
current_group: "{{ docker_group }}"
current_docker: "{{ webdav_docker }}"
- name: "Deploy service templates for webdav"
include_role:
name: _deploy
tasks_from: templates
vars:
current_config: "webdav"
current_base_path: "{{ service_base_path }}"
current_destination: "{{ inventory_hostname }}"
current_owner: "{{ docker_owner }}"
current_group: "{{ docker_group }}"
- name: "Update {{ inventory_hostname }}"
shell: docker-compose pull
args:
chdir: '{{ service_base_path }}/{{ inventory_hostname }}'
tags:
- update_deployment
- name: "Start {{ inventory_hostname }}"
shell: docker-compose up -d
args:
chdir: '{{ service_base_path }}/{{ inventory_hostname }}'
- name: "Send mattermost messsge"
uri:
url: "{{ mattermost_hook_smardigo }}"
method: POST
body: "{{ lookup('template','mattermost-deploy-end.json.j2') }}"
body_format: json
headers:
Content-Type: "application/json"
delegate_to: 127.0.0.1
become: false
when:
- send_status_messages