Initial
This commit is contained in:
commit
9b8494b33b
7 changed files with 117 additions and 0 deletions
53
tasks/main.yml
Normal file
53
tasks/main.yml
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
- 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
|
Loading…
Add table
Add a link
Reference in a new issue