summaryrefslogtreecommitdiffstats
path: root/roles/bittorrent/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/bittorrent/tasks')
-rw-r--r--roles/bittorrent/tasks/config.yml39
-rw-r--r--roles/bittorrent/tasks/main.yml11
-rw-r--r--roles/bittorrent/tasks/pkgs.yml7
-rw-r--r--roles/bittorrent/tasks/services.yml2
-rw-r--r--roles/bittorrent/tasks/update.yml21
5 files changed, 80 insertions, 0 deletions
diff --git a/roles/bittorrent/tasks/config.yml b/roles/bittorrent/tasks/config.yml
new file mode 100644
index 0000000..e852230
--- /dev/null
+++ b/roles/bittorrent/tasks/config.yml
@@ -0,0 +1,39 @@
+- name: Limite down permanent
+ command: transmission-remote --downlimit 400
+
+- name: Limite up permanent
+ command: transmission-remote --uplimit 30
+
+- name: Limite down alternative
+ command: transmission-remote --downlimit 100
+
+- name: Limite up alternative
+ command: transmission-remote --uplimit 20
+
+- name: Début limites alternatives
+ command: transmission-remote --alt-speed-time-begin 0533
+
+- name: Fin limites alternatives
+ command: transmission-remote --alt-speed-time-end 0033
+
+- name: Activation limites alternatives
+ command: transmission-remote --alt-speed-scheduler
+
+- name: Connexions P2P chiffrement requis
+ command: transmission-remote --encryption-required
+
+- name: Activation LPD
+ command: transmission-remote --lds
+
+- name: Nombre maximum de pairs
+ command: transmission-remote --peers 1024
+
+- name: Désactivation UPnP
+ command: transmission-remote --portmap
+
+- name: Ouverture des ports Firewalld
+ firewalld: port=51413 permanent={{ item }} state=enabled
+ with_items:
+ - true
+ - false
+ when: ansible_distribution == "Fedora"
diff --git a/roles/bittorrent/tasks/main.yml b/roles/bittorrent/tasks/main.yml
new file mode 100644
index 0000000..b66bdd8
--- /dev/null
+++ b/roles/bittorrent/tasks/main.yml
@@ -0,0 +1,11 @@
+- name: Installation des paquets
+ include: pkgs.yml
+
+- name: Démarrage du service pour accèder à la configuration
+ include: services.yml
+
+- name: Configuration du service
+ include: config.yml
+
+- name: Mise à jour du service
+ include: update.yml
diff --git a/roles/bittorrent/tasks/pkgs.yml b/roles/bittorrent/tasks/pkgs.yml
new file mode 100644
index 0000000..f5b0f87
--- /dev/null
+++ b/roles/bittorrent/tasks/pkgs.yml
@@ -0,0 +1,7 @@
+- name: Installation de transmission
+ yum: name=transmission-daemon state=present
+ when: ansible_pkg_mgr == "yum"
+
+- name: Installation de transmission
+ dnf: name=transmission-daemon state=present
+ when: ansible_pkg_mgr == "dnf"
diff --git a/roles/bittorrent/tasks/services.yml b/roles/bittorrent/tasks/services.yml
new file mode 100644
index 0000000..319a0f8
--- /dev/null
+++ b/roles/bittorrent/tasks/services.yml
@@ -0,0 +1,2 @@
+- name: Activation et démarrage du service transmission-daemon
+ service: name=transmission-daemon state=started enabled=yes
diff --git a/roles/bittorrent/tasks/update.yml b/roles/bittorrent/tasks/update.yml
new file mode 100644
index 0000000..44a8498
--- /dev/null
+++ b/roles/bittorrent/tasks/update.yml
@@ -0,0 +1,21 @@
+- name: Récupération de la liste des torrents disponibles
+ shell: torsocks curl -sS https://torrents.fedoraproject.org/torrents/ | grep torrent | grep -v Index | awk '{ print $6 }' | cut -d '"' -f2 | sed 's/.torrent//'
+ args:
+ executable: /usr/bin/zsh
+ delegate_to: localhost
+ register: namefedora
+
+- name: Vérifier la présence de tous les torrents
+ shell: transmission-remote -l | grep '{{ item }}'
+ args:
+ executable: /usr/bin/zsh
+ with_items:
+ - "{{ namefedora.stdout_lines }}"
+ register: result
+ ignore_errors: yes
+
+- name: Mise à jour de transmission-daemon
+ command: transmission-remote -a https://torrents.fedoraproject.org/torrents/'{{ item }}'.torrent
+ with_items:
+ - "{{ namefedora.stdout_lines }}"
+ when: result is failed