This repository has been archived on 2024-11-01. You can view files and clone it, but cannot push or open issues or pull requests.
services/roles/gethomepage/tasks/main.yml

70 lines
2.1 KiB
YAML
Raw Normal View History

2024-01-01 23:33:59 +00:00
---
- name: Set common facts
ansible.builtin.import_tasks: tasks/set-default-facts.yml
- name: Deploy {{ svc.name }}
vars:
svc: "{{ gethomepage_svc }}"
compose: "{{ gethomepage_compose }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Set config path
ansible.builtin.set_fact:
config_path: "{{ (service_path, 'config') | path_join }}"
- name: Create config directory
ansible.builtin.file:
path: "{{ config_path }}"
state: directory
mode: "0755"
- name: Template settings
ansible.builtin.template:
src: yml.j2
dest: "{{ (config_path, 'settings.yaml') | path_join }}"
mode: "0644"
vars:
yml: "{{ gethomepage_settings_yml }}"
register: cmd_result_settings
- name: Template services
ansible.builtin.template:
src: yml.j2
dest: "{{ (config_path, 'services.yaml') | path_join }}"
mode: "0644"
vars:
yml: "{{ gethomepage_services_yml }}"
register: cmd_result_services
- name: Template booksmarks
ansible.builtin.template:
src: yml.j2
dest: "{{ (config_path, 'booksmarks.yaml') | path_join }}"
mode: "0644"
vars:
yml: "{{ gethomepage_bookmarks_yml }}"
register: cmd_result_booksmarks
- name: Template widgets
ansible.builtin.template:
src: yml.j2
dest: "{{ (config_path, 'widgets.yaml') | path_join }}"
mode: "0644"
vars:
yml: "{{ gethomepage_widgets_yml }}"
register: cmd_result_widgets
- name: Set the docker force-recreate flag
ansible.builtin.set_fact:
docker_force_recreate: --force-recreate
when: | # noqa: no-handler We need to handle the restart per service. Handlers don't support variables.
cmd_result_settings.changed
or cmd_result_services.changed
or cmd_result_booksmarks.changed
or cmd_result_widgets.changed
- name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml