Fix launchctl idempotency in kiwix and borgmatic roles
Check if LaunchAgent is already loaded before attempting to load it. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e534e59556
commit
2f28b151f5
2 changed files with 16 additions and 6 deletions
|
|
@ -9,8 +9,13 @@
|
|||
mode: '0644'
|
||||
notify: reload borgmatic
|
||||
|
||||
- name: Ensure borgmatic LaunchAgent is loaded
|
||||
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.borgmatic.plist
|
||||
register: launchctl_load
|
||||
changed_when: launchctl_load.rc == 0
|
||||
- name: Check if borgmatic LaunchAgent is loaded
|
||||
ansible.builtin.command: launchctl list mcquack.eblume.borgmatic
|
||||
register: launchctl_check
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Load borgmatic LaunchAgent if not loaded
|
||||
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.borgmatic.plist
|
||||
when: launchctl_check.rc != 0
|
||||
failed_when: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue