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_install_method: pip
borg_ssh_key_file: "{{ backup_user_info.home }}/.ssh/backup" borg_ssh_key_file: "{{ backup_user_info.home }}/.ssh/backup"
borg_ssh_command: "ssh -i {{ borg_ssh_key_file }} -o StrictHostKeyChecking=no" borg_ssh_command: "ssh -i {{ borg_ssh_key_file }} -o StrictHostKeyChecking=no"
borgmatic_timer: "systemd" borgmatic_timer: cron
post_tasks: post_tasks:
- name: Install yamllint for checking config file - name: Install yamllint for checking config file

View File

@ -24,7 +24,7 @@
# If the role is running and the repo is not yet initialized, an error will occur. # 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. # Therefore the service is stopped by default and must be started manually.
- name: Stop fresh installed borgmatic.timer and borgmatic.service - name: Stop fresh installed borgmatic.timer and borgmatic.service
when: ('borgmatic.service' not in services) when: "'borgmatic.service' not in ansible_facts.services"
block: block:
- name: Set borgmatic services to stopped - fresh installed - name: Set borgmatic services to stopped - fresh installed
ansible.builtin.systemd: ansible.builtin.systemd:
@ -33,7 +33,7 @@
enabled: false enabled: false
masked: false masked: false
daemon_reload: true daemon_reload: true
when: "item in services" when: item in ansible_facts.services
with_items: with_items:
- borgmatic.service - borgmatic.service