feat: initial commit
This commit is contained in:
commit
3f0a878c3a
18 changed files with 321 additions and 0 deletions
11
tasks/config.yaml
Normal file
11
tasks/config.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
|
||||
# configure atuin
|
||||
- name: "config - atuin"
|
||||
ansible.builtin.template:
|
||||
src: "templates/atuin/server.toml.j2"
|
||||
dest: "/etc/atuin/server.toml"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
notify: "restart atuin"
|
||||
54
tasks/install.yaml
Normal file
54
tasks/install.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
|
||||
# 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"
|
||||
|
||||
# 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"
|
||||
when: "atuin_version not in atuin_version_check.stdout"
|
||||
register: "atuin_download"
|
||||
|
||||
# install atuin
|
||||
- name: "install atuin"
|
||||
ansible.builtin.unarchive:
|
||||
src: "/tmp/atuin-x86_64-unknown-linux-gnu.tar.gz"
|
||||
dest: "/usr/local/bin/"
|
||||
include: "atuin"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
remote_src: true
|
||||
when: "atuin_download.changed"
|
||||
|
||||
# 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_download.changed"
|
||||
20
tasks/main.yaml
Normal file
20
tasks/main.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
|
||||
# check os support
|
||||
- name: "check for os support"
|
||||
ansible.builtin.import_tasks: "ossupport.yaml"
|
||||
|
||||
# load os variables
|
||||
- name: "include os specific vars"
|
||||
ansible.builtin.include_vars: "{{ ansible_os_family }}.yaml"
|
||||
when: "os_support"
|
||||
|
||||
# import install
|
||||
- name: "install"
|
||||
ansible.builtin.import_tasks: "install.yaml"
|
||||
when: "os_support"
|
||||
|
||||
# import config
|
||||
- name: "config"
|
||||
ansible.builtin.import_tasks: "config.yaml"
|
||||
when: "os_support"
|
||||
16
tasks/ossupport.yaml
Normal file
16
tasks/ossupport.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
|
||||
# support debian 12
|
||||
- name: "check for os support"
|
||||
ansible.builtin.set_fact:
|
||||
os_support: true
|
||||
when:
|
||||
- 'ansible_distribution == "Debian"'
|
||||
- 'ansible_distribution_major_version == "12"'
|
||||
|
||||
# fail role when not supported
|
||||
- name: "unsupported role"
|
||||
ansible.builtin.fail:
|
||||
msg: "This role not supported on this Operating System."
|
||||
when:
|
||||
- "os_support is not defined"
|
||||
Loading…
Add table
Add a link
Reference in a new issue