Try to find services in ansible_facts

This commit is contained in:
Manu 2023-03-18 17:08:46 +00:00
parent 6b88b7c97e
commit a39e889ba8
2 changed files with 5 additions and 5 deletions

View File

@ -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

View 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: