ansible-collection-famedly-.../roles/hedwig/tasks/main.yml
Jan Christian Grünhage 14f1e22f8b
chore(hedwig): fix lints
2023-07-07 01:03:31 +02:00

57 lines
1.8 KiB
YAML

---
- name: Create hedwig system user
user:
name: "{{ hedwig_user }}"
state: present
system: true
register: hedwig_user_res
- name: Ensure host directories are present
file:
path: "{{ hedwig_base_path }}"
state: directory
owner: "{{ hedwig_user_res.uid }}"
group: "{{ hedwig_user_res.group }}"
mode: "0755"
- name: Template configuration file for hedwig
copy:
# default required to make linter happy
content: "{{ hedwig_config | default({}) | to_nice_yaml(indent=2, width=1000) }}"
dest: "{{ hedwig_config_file }}"
owner: "{{ hedwig_user_res.uid }}"
group: "{{ hedwig_user_res.group }}"
mode: "0640"
notify: restart-hedwig
- name: Write FCM service account file
copy:
content: >
{% if hedwig_fcm_service_account_credentials is mapping %}
{{ hedwig_fcm_service_account_credentials | to_json }}
{% else %}
{{ hedwig_fcm_service_account_credentials }}
{% endif %}
dest: "{{ hedwig_fcm_service_account_file }}"
owner: "{{ hedwig_user_res.uid }}"
group: "{{ hedwig_user_res.group }}"
mode: "0640"
notify: restart-hedwig
- name: Start hedwig container
community.docker.docker_container:
name: "{{ hedwig_container_name }}"
image: "{{ hedwig_container_image }}"
env: "{{ hedwig_container_env }}"
user: "{{ hedwig_user_res.uid }}:{{ hedwig_user_res.group }}"
ports: "{{ hedwig_container_ports }}"
labels: "{{ hedwig_container_labels_complete }}"
volumes: "{{ hedwig_container_volumes }}"
working_dir: "{{ hedwig_base_path }}"
restart_policy: "{{ hedwig_container_restart_policy }}"
pull: true
## Commented out for now, because the new hedwig version doesn't have healthchecks
# healthcheck:
# test: "curl http://[::1]:{{ hedwig_server_port }}/health || exit 1"
state: started