67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
---
|
|
# tasks file for gotosocial
|
|
- name: Create gotosocial user
|
|
ansible.builtin.user:
|
|
name: "{{ gotosocial_user }}"
|
|
system: true
|
|
state: present
|
|
|
|
- name: Create gotosocial directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
owner: "{{ gotosocial_user }}"
|
|
group: "{{ gotosocial_group | default(gotosocial_user) }}"
|
|
mode: "0750"
|
|
state: directory
|
|
loop:
|
|
- "{{ gotosocial_base_dir }}"
|
|
- "{{ gotosocial_base_dir }}/storage"
|
|
- "{{ gotosocial_base_dir }}/storage/certs"
|
|
|
|
- name: Download gotosocial release
|
|
ansible.builtin.get_url:
|
|
url: "{{ gotosocial_release_url }}"
|
|
dest: "{{ gotosocial_base_dir }}/gotosocial_{{ gotosocial_version }}_linux_amd64.tar.gz"
|
|
owner: "{{ gotosocial_user }}"
|
|
group: "{{ gotosocial_group | default(gotosocial_user) }}"
|
|
mode: "0640"
|
|
force: false
|
|
retries: 3
|
|
delay: 3
|
|
register: gotosocial_tarball
|
|
until: gotosocial_tarball is not failed
|
|
|
|
- name: Unpack gotosocial binary
|
|
ansible.builtin.unarchive:
|
|
src: "{{ gotosocial_tarball['dest'] }}"
|
|
dest: "{{ gotosocial_base_dir }}/"
|
|
remote_src: true
|
|
owner: "{{ gotosocial_user }}"
|
|
group: "{{ gotosocial_group | default(gotosocial_user) }}"
|
|
mode: "0750"
|
|
keep_newer: true
|
|
notify: Restart gotosocial
|
|
|
|
- name: Template gotosocial configuration
|
|
ansible.builtin.template:
|
|
src: config.yaml.j2
|
|
dest: "{{ gotosocial_base_dir }}/config.yaml"
|
|
owner: "{{ gotosocial_user }}"
|
|
group: "{{ gotosocial_group | default(gotosocial_user) }}"
|
|
mode: "0750"
|
|
notify: Restart gotosocial
|
|
|
|
- name: Template gotosocial systemd service
|
|
ansible.builtin.template:
|
|
src: gotosocial.service.j2
|
|
dest: /etc/systemd/system/gotosocial.service
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
notify: Restart gotosocial
|
|
|
|
- name: Enable and start gotosocial systemd service
|
|
ansible.builtin.systemd:
|
|
name: gotosocial.service
|
|
state: started
|
|
enabled: true
|