ansible-role-diun/tasks/main.yml

54 lines
1.2 KiB
YAML
Raw Normal View History

2023-03-01 10:56:33 +01:00
---
- name: "Create user"
ansible.builtin.user:
name: "{{ diun_user }}"
shell: /bin/false
create_home: false
password_lock: true
system: true
group: "{{ diun_user }}"
- name: "Get download URL"
ansible.builtin.shell:
cmd: curl -sL "{{ diun_github_api_url }}" | jq '.assets[] | select(.name|match("linux_amd64.tar.gz$")) | .browser_download_url'"
changed_when: false
register: download_url
- name: "Unarchive binary"
ansible.builtin.unarchive:
src: download_url.stdout
dest: "{{ diun_binary_path }}"
include:
- diun
mode: 0755
- name: "Create directories"
ansible.builtin.file:
path: "{{ item }}"
owner: "{{ diun_user }}"
group: "{{ diun_user }}"
mode: 0750
loop:
- "{{ diun_configuration_path }}"
- "{{ diun_home }}"
- name: "Copy configuration file"
ansible.builtin.template:
src: "{{ diun_configuration_file }}"
dest: "{{ diun_configuration_path }}"
mode: 0644
- name: "Copy service file"
ansible.builtin.template:
src: diun.service
dest: /etc/systemd/system/
mode: 0644
notify: restart duin
- name: "Enable service"
ansible.builtin.systemd:
name: diun
enabled: true
daemon_reload: true
state: started