infrastructure/playbooks/roles/teamspeak_fallback/tasks/main.yml

65 lines
2.1 KiB
YAML
Raw Normal View History

2024-09-26 22:02:36 +00:00
---
- name: Set common facts
ansible.builtin.import_tasks: tasks/set-default-facts.yml
2024-10-13 19:48:04 +00:00
- name: Deploy {{ role_name }}
2024-09-26 22:02:36 +00:00
vars:
svc: "{{ teamspeak_fallback_svc }}"
2024-10-13 19:02:19 +00:00
compose: "{{ teamspeak_fallback_compose }}"
env: "{{ teamspeak_fallback_env }}"
yml: "{{ teamspeak_fallback_yml }}"
2024-09-26 22:02:36 +00:00
block:
2024-10-13 19:02:19 +00:00
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
2024-09-26 22:02:36 +00:00
- name: Template the conditional-start script
ansible.builtin.template:
src: conditional-start.sh.j2
dest: "{{ (service_path, 'conditional-start.sh') | path_join }}"
mode: "0755"
2024-10-13 19:02:19 +00:00
- name: Set webhook 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 main config
ansible.builtin.template:
src: yml.j2
dest: "{{ (config_path, 'hooks.yml') | path_join }}"
mode: "0644"
register: cmd_result
- name: Set the docker force-recreate flag
ansible.builtin.set_fact:
docker_force_recreate: --force-recreate
when: cmd_result.changed # noqa: no-handler We need to handle the restart per service. Handlers don't support variables.
- name: Copy the teamspeak-fallback-db script
ansible.builtin.copy:
src: teamspeak-fallback-db
dest: "{{ (config_path, 'teamspeak-fallback-db') | path_join }}"
mode: "0755"
- name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml
2024-09-26 22:02:36 +00:00
- name: Copy the system service
ansible.builtin.template:
src: teamspeak-fallback.service.j2
dest: /etc/systemd/system/teamspeak-fallback.service
mode: "0644"
become: true
- name: Enable the system service
ansible.builtin.systemd_service:
name: teamspeak-fallback.service
state: started
enabled: true
daemon_reload: true
become: true