This commit is contained in:
phil 2023-03-01 11:35:03 +01:00
parent 9b8494b33b
commit dd8f45246f
4 changed files with 29 additions and 12 deletions

View file

@ -1,4 +1,10 @@
---
- name: "Create group"
ansible.builtin.group:
name: "{{ diun_user }}"
state: present
system: true
- name: "Create user"
ansible.builtin.user:
name: "{{ diun_user }}"
@ -10,21 +16,25 @@
- 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'"
cmd: curl -sL "{{ diun_github_api_url }}" | jq -r '.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
src: "{{ download_url.stdout }}"
dest: "{{ diun_binary_path }}"
include:
- diun
remote_src: true
include: diun
mode: 0755
extra_opts:
- "--strip=1"
- "--no-anchored"
- name: "Create directories"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ diun_user }}"
group: "{{ diun_user }}"
mode: 0750
@ -43,7 +53,7 @@
src: diun.service
dest: /etc/systemd/system/
mode: 0644
notify: restart duin
notify: restart diun
- name: "Enable service"
ansible.builtin.systemd: