Add async task for doom emacs sync

This commit is contained in:
exu 2024-11-12 17:01:55 +01:00
parent 2d80cc1c7d
commit 539ecdea46
3 changed files with 40 additions and 12 deletions

View File

@ -0,0 +1,15 @@
---
- name: Doom Emacs | Check if installed
ansible.builtin.stat:
path: "~/.config/emacs/bin/doom"
register: doom_emacs
tags: config
- name: Doom Emacs | Update if present - aync
ansible.builtin.shell:
cmd: "~/.config/emacs/bin/doom sync"
when: doom_emacs.stat.exists
async: 600
poll: 0
register: async_doom_emacs
tags: config

View File

@ -0,0 +1,13 @@
---
- name: Doom Emacs | Check on async job
async_status:
jid: "{{ async_doom_emacs.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 60
delay: 10
- name: Doom Emacs | Cleanup async job
async_status:
jid: "{{ async_doom_emacs.ansible_job_id }}"
mode: cleanup

View File

@ -112,6 +112,12 @@
mode: "0755" mode: "0755"
tags: config tags: config
# Start async tasks early
- name: Import Tasks from async.yml
ansible.builtin.import_tasks:
file: async.yml
tags: config
- name: Reload system systemd services - name: Reload system systemd services
ansible.builtin.systemd_service: ansible.builtin.systemd_service:
daemon_reload: true daemon_reload: true
@ -303,19 +309,13 @@
cmd: "update-desktop-database ~/.local/share/applications/" cmd: "update-desktop-database ~/.local/share/applications/"
tags: config tags: config
- name: Doom Emacs | Check if installed
ansible.builtin.stat:
path: "~/.config/emacs/bin/doom"
register: doom_emacs
tags: config
- name: Doom Emacs | Update if present
ansible.builtin.shell:
cmd: "~/.config/emacs/bin/doom sync"
when: doom_emacs.stat.exists
tags: config
- name: Import Tasks from plasma.yml - name: Import Tasks from plasma.yml
ansible.builtin.import_tasks: ansible.builtin.import_tasks:
file: plasma.yml file: plasma.yml
tags: config tags: config
# Async task callbacks
- name: Import Tasks from async_check.yml
ansible.builtin.import_tasks:
file: async_check.yml
tags: config