Holding both states, absent and present

This commit is contained in:
2021-12-19 12:03:28 +01:00
parent 632c3b1b7e
commit ffbb5b3832
3 changed files with 50 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
---
flatpak_configure_remotes: true
flatpak_alter_flatpaks: true
flatpak_automatic_updates: true
flatpak_automatic_updates: false

View File

@@ -1,13 +0,0 @@
---
- name: Enable flatpak-automatic
ansible.builtin.systemd:
name: flatpak-automatic.timer
state: started
enabled: yes
daemon_reload: yes
become: yes
- name: Update Flatpaks
ansible.builtin.command:
cmd: flatpak update -y
become: yes

View File

@@ -9,6 +9,8 @@
# https://github.com/flatpak/flatpak/issues/3847#issuecomment-818532856
- name: Enable flatpak Automatic Update
block:
- name: Place systemd service and timer
ansible.builtin.template:
src: "{{ item }}"
dest: "/etc/systemd/system/{{ item | regex_replace('.j2', '') }}"
@@ -22,3 +24,37 @@
notify:
- Enable flatpak-automatic
when: flatpak_automatic_updates | bool
- name: Enable systemd timer
ansible.builtin.systemd:
name: flatpak-automatic.timer
state: started
enabled: yes
daemon_reload: yes
become: yes
when: flatpak_automatic_updates | bool
- name: Update Flatpaks
ansible.builtin.command:
cmd: flatpak update -y
when: flatpak_automatic_updates | bool
- name: Disable flatpak Automatic Update
block:
- name: Disable systemd timer
ansible.builtin.systemd:
name: flatpak-automatic.timer
state: stopped
enabled: no
become: yes
when: not flatpak_automatic_updates | bool
- name: Remove systemd service and timer
ansible.builtin.file:
path: "/etc/systemd/system/{{ item }}"
state: absent
become: yes
with_items:
- flatpak-automatic.service
- flatpak-automatic.timer
when: not flatpak_automatic_updates | bool