diff options
author | Matthieu Saulnier <fantom@fedoraproject.org> | 2023-09-11 08:46:03 +0200 |
---|---|---|
committer | Matthieu Saulnier <fantom@fedoraproject.org> | 2023-09-11 08:46:03 +0200 |
commit | a5f15cec40bf4e9bfcb0fbd7935f6c09681a287c (patch) | |
tree | e96c32eb5ea4eb3b235e2ae56f61c5e67a989ab1 | |
parent | dafef07598376b20e1a3c5767c78f81a2b6456e3 (diff) | |
download | playbooks-ansible-a5f15cec40bf4e9bfcb0fbd7935f6c09681a287c.tar.gz playbooks-ansible-a5f15cec40bf4e9bfcb0fbd7935f6c09681a287c.tar.xz playbooks-ansible-a5f15cec40bf4e9bfcb0fbd7935f6c09681a287c.zip |
Introduce the use of fedoraversion variable and add task for cleanup
in bittorrent role
-rw-r--r-- | roles/bittorrent/defaults/main.yml | 1 | ||||
-rw-r--r-- | roles/bittorrent/tasks/update.yml | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/roles/bittorrent/defaults/main.yml b/roles/bittorrent/defaults/main.yml index 4cc5a15..bf33bf8 100644 --- a/roles/bittorrent/defaults/main.yml +++ b/roles/bittorrent/defaults/main.yml @@ -2,3 +2,4 @@ downspeed: "400" upspeed: "400" altdownspeed: "200" altupspeed: "200" +fedoraversion: 39 diff --git a/roles/bittorrent/tasks/update.yml b/roles/bittorrent/tasks/update.yml index 8eed537..03eb1eb 100644 --- a/roles/bittorrent/tasks/update.yml +++ b/roles/bittorrent/tasks/update.yml @@ -1,10 +1,29 @@ +- name: Calcul du numéro de version précédente + shell: echo $(('{{ fedoraversion }}' - 1)) + args: + executable: /usr/bin/zsh + run_once: true + register: nversion + - name: Récupération de la liste des torrents disponibles - shell: curl -sS https://torrents.fedoraproject.org/torrents/ | grep torrent | grep -v Index | awk '{ print $6 }' | cut -d '"' -f2 | sed 's/.torrent//' | egrep -vi 'alpha|beta' |grep 37 + shell: curl -sS https://torrents.fedoraproject.org/torrents/ | grep torrent | grep -v Index | awk '{ print $6 }' | cut -d '"' -f2 | sed 's/.torrent//' | egrep -vi 'alpha|beta' |grep '{{ fedoraversion }}' args: executable: /usr/bin/zsh run_once: true register: torrentlist +- name: Récupération de la liste des anciennes versions + shell: curl -sS https://torrents.fedoraproject.org/torrents/ | grep torrent | grep -v Index | awk '{ print $6 }' | cut -d '"' -f2 | sed 's/.torrent//' | egrep -vi 'alpha|beta' |grep '{{ nversion.stdout }}' + args: + executable: /usr/bin/zsh + run_once: true + register: oldlist + +- name: Nettoyage anciens torrents + command: transmission-remote -rad '{{ item }}'.torrent + loop: "{{ oldlist.stdout_lines }}" + ignore_errors: yes + - name: Vérifier la présence de tous les torrents shell: transmission-remote -l | grep '{{ item }}' args: |