mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2025-05-20 01:15:09 +02:00
Try to find services in ansible_facts
This commit is contained in:
parent
6b88b7c97e
commit
a39e889ba8
@ -41,7 +41,7 @@
|
||||
borg_install_method: pip
|
||||
borg_ssh_key_file: "{{ backup_user_info.home }}/.ssh/backup"
|
||||
borg_ssh_command: "ssh -i {{ borg_ssh_key_file }} -o StrictHostKeyChecking=no"
|
||||
borgmatic_timer: "systemd"
|
||||
borgmatic_timer: cron
|
||||
|
||||
post_tasks:
|
||||
- name: Install yamllint for checking config file
|
||||
|
@ -24,8 +24,8 @@
|
||||
# If the role is running and the repo is not yet initialized, an error will occur.
|
||||
# Therefore the service is stopped by default and must be started manually.
|
||||
- name: Stop fresh installed borgmatic.timer and borgmatic.service
|
||||
when: ('borgmatic.service' not in services)
|
||||
block:
|
||||
when: "'borgmatic.service' not in ansible_facts.services"
|
||||
block:
|
||||
- name: Set borgmatic services to stopped - fresh installed
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ item }}"
|
||||
@ -33,10 +33,10 @@
|
||||
enabled: false
|
||||
masked: false
|
||||
daemon_reload: true
|
||||
when: "item in services"
|
||||
when: item in ansible_facts.services
|
||||
with_items:
|
||||
- borgmatic.service
|
||||
|
||||
|
||||
# bug: Need own section without masked else the timer are skipped
|
||||
- name: Set borgmatic timers to stopped - fresh installed
|
||||
ansible.builtin.systemd:
|
||||
|
Loading…
Reference in New Issue
Block a user