65 lines
1.8 KiB
YAML
65 lines
1.8 KiB
YAML
---
|
|
|
|
# check current atuin version
|
|
- name: "check current version"
|
|
ansible.builtin.shell:
|
|
cmd: "/usr/local/bin/atuin -V"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: "atuin_version_check"
|
|
|
|
# delete current atuin version
|
|
- name: "delete current version"
|
|
ansible.builtin.file:
|
|
path: "/usr/local/bin/atuin"
|
|
state: "absent"
|
|
when: "atuin_version not in atuin_version_check.stdout"
|
|
|
|
# download atuin
|
|
- name: "download atuin"
|
|
ansible.builtin.get_url:
|
|
url:
|
|
"https://github.com/atuinsh/atuin/releases/download/\
|
|
v{{ atuin_version }}/atuin-x86_64-unknown-linux-gnu.tar.gz"
|
|
dest: "/tmp/"
|
|
checksum:
|
|
"sha256:https://github.com/atuinsh/atuin/releases/download/\
|
|
v{{ atuin_version }}/atuin-x86_64-unknown-linux-gnu.tar.gz.sha256"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0775"
|
|
register: "atuin_download"
|
|
when: "atuin_version not in atuin_version_check.stdout"
|
|
|
|
# install atuin
|
|
- name: "install atuin"
|
|
ansible.builtin.unarchive:
|
|
src: "/tmp/atuin-x86_64-unknown-linux-gnu.tar.gz"
|
|
dest: "/usr/local/bin/"
|
|
include: "atuin-x86_64-unknown-linux-gnu/atuin"
|
|
extra_opts: [ "--strip-components=1" ]
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0755"
|
|
remote_src: true
|
|
notify: "restart atuin"
|
|
when:
|
|
- "atuin_download.changed"
|
|
- "atuin_version not in atuin_version_check.stdout"
|
|
|
|
# install systemd service
|
|
- name: "install service"
|
|
ansible.builtin.template:
|
|
src: "templates/systemd/atuin.service.j2"
|
|
dest: "/etc/systemd/system/atuin.service"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
notify: "restart atuin"
|
|
|
|
# cleanup atuin
|
|
- name: "cleanup atuin installer"
|
|
ansible.builtin.file:
|
|
path: "/tmp/atuin-x86_64-unknown-linux-gnu.tar.gz"
|
|
state: "absent"
|
|
when: "atuin_version not in atuin_version_check.stdout"
|