add flatpak-automatic
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
---
|
||||
flatpak_configure_remotes: true
|
||||
flatpak_alter_flatpaks: true
|
||||
flatpak_automatic_updates: true
|
||||
|
||||
8
roles/flatpak/files/flatpak-automatic.service
Normal file
8
roles/flatpak/files/flatpak-automatic.service
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=flatpak Automatic Update
|
||||
Documentation=man:flatpak(1)
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/bin/sh -c 'until ping -c1 google.com; do sleep 1; done;'
|
||||
ExecStart=/usr/bin/flatpak update -y
|
||||
11
roles/flatpak/files/flatpak-automatic.timer
Normal file
11
roles/flatpak/files/flatpak-automatic.timer
Normal file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=flatpak Automatic Update Trigger
|
||||
Documentation=man:flatpak(1)
|
||||
|
||||
[Timer]
|
||||
OnBootSec=1m
|
||||
OnCalendar=*-*-* *:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
8
roles/flatpak/handlers/main.yml
Normal file
8
roles/flatpak/handlers/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Enable flatpak-automatic
|
||||
ansible.builtin.systemd:
|
||||
name: flatpak-automatic.timer
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
become: yes
|
||||
12
roles/flatpak/tasks/flatpaks.yml
Normal file
12
roles/flatpak/tasks/flatpaks.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Merge Flatpaks and overwrites
|
||||
set_fact:
|
||||
flatpak_flatpaks: '{{ flatpak_flatpaks | combine(flatpak_flatpaks_overwrite) }}'
|
||||
when: flatpak_flatpaks_overwrite | default()
|
||||
|
||||
- name: Add/remove Flatpaks
|
||||
community.general.flatpak:
|
||||
name: "{{ item.key }}"
|
||||
state: "{{ item.value.state }}"
|
||||
remote: "{{ item.value.remote }}"
|
||||
loop: "{{ lookup('dict', flatpak_flatpaks, wantlist=True) }}"
|
||||
@@ -1,27 +1,23 @@
|
||||
---
|
||||
- name: Merge Flatpak remotes and overwrites
|
||||
set_fact:
|
||||
flatpak_remotes: '{{ flatpak_remotes | combine(flatpak_remotes_overwrite) }}'
|
||||
when: flatpak_remotes_overwrite | default()
|
||||
|
||||
- name: Add/remove Flatpak remotes
|
||||
community.general.flatpak_remote:
|
||||
name: "{{ item.key }}"
|
||||
state: "{{ item.value.state }}"
|
||||
flatpakrepo_url: "{{ item.value.url }}"
|
||||
become: true
|
||||
loop: "{{ lookup('dict', flatpak_remotes, wantlist=True) }}"
|
||||
- name: Include remotes.yml
|
||||
ansible.builtin.include: remotes.yml
|
||||
when: flatpak_configure_remotes | bool
|
||||
|
||||
- name: Merge Flatpaks and overwrites
|
||||
set_fact:
|
||||
flatpak_flatpaks: '{{ flatpak_flatpaks | combine(flatpak_flatpaks_overwrite) }}'
|
||||
when: flatpak_flatpaks_overwrite | default()
|
||||
|
||||
- name: Add/remove Flatpaks
|
||||
community.general.flatpak:
|
||||
name: "{{ item.key }}"
|
||||
state: "{{ item.value.state }}"
|
||||
remote: "{{ item.value.remote }}"
|
||||
loop: "{{ lookup('dict', flatpak_flatpaks, wantlist=True) }}"
|
||||
- name: Include flatpaks.yml
|
||||
ansible.builtin.include: flatpaks.yml
|
||||
when: flatpak_alter_flatpaks | bool
|
||||
|
||||
- name: Enable flatpak Automatic Update
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/systemd/system/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
become: yes
|
||||
with_items:
|
||||
- flatpak-automatic.service
|
||||
- flatpak-automatic.timer
|
||||
notify:
|
||||
- Enable flatpak-automatic
|
||||
when: flatpak_automatic_updates | bool
|
||||
|
||||
13
roles/flatpak/tasks/remotes.yml
Normal file
13
roles/flatpak/tasks/remotes.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Merge Flatpak remotes and overwrites
|
||||
set_fact:
|
||||
flatpak_remotes: '{{ flatpak_remotes | combine(flatpak_remotes_overwrite) }}'
|
||||
when: flatpak_remotes_overwrite | default()
|
||||
|
||||
- name: Add/remove Flatpak remotes
|
||||
community.general.flatpak_remote:
|
||||
name: "{{ item.key }}"
|
||||
state: "{{ item.value.state }}"
|
||||
flatpakrepo_url: "{{ item.value.url }}"
|
||||
become: true
|
||||
loop: "{{ lookup('dict', flatpak_remotes, wantlist=True) }}"
|
||||
Reference in New Issue
Block a user