summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Saulnier <fantom@fedoraproject.org>2018-07-15 21:38:55 +0200
committerMatthieu Saulnier <fantom@fedoraproject.org>2018-07-15 21:38:55 +0200
commit0f0f5dc291d8c649e205fb29e3b6b8cd9c254395 (patch)
tree9b1a1ee9f6e57571142b47182342e51be013590a
parenta625df4e82152239f388c170e2c1720d865f124d (diff)
downloadplaybooks-ansible-0f0f5dc291d8c649e205fb29e3b6b8cd9c254395.zip
playbooks-ansible-0f0f5dc291d8c649e205fb29e3b6b8cd9c254395.tar.gz
playbooks-ansible-0f0f5dc291d8c649e205fb29e3b6b8cd9c254395.tar.xz
Create new bittorrent role
-rw-r--r--bittorrent.yml5
-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
-rw-r--r--roles/bittorrent/vars/main.yml28
-rw-r--r--site.yml1
8 files changed, 114 insertions, 0 deletions
diff --git a/bittorrent.yml b/bittorrent.yml
new file mode 100644
index 0000000..285e99b
--- /dev/null
+++ b/bittorrent.yml
@@ -0,0 +1,5 @@
+- hosts: bt
+ remote_user: root
+ any_errors_fatal: true
+ roles:
+ - bittorrent
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
diff --git a/roles/bittorrent/vars/main.yml b/roles/bittorrent/vars/main.yml
new file mode 100644
index 0000000..9383c32
--- /dev/null
+++ b/roles/bittorrent/vars/main.yml
@@ -0,0 +1,28 @@
+defconstatic:
+ - DEF CON 10 video
+ - DEF CON 11 video
+ - DEF CON 12 video
+ - DEF CON 13 video
+ - DEF CON 14 video
+ - DEF CON 15 video
+ - DEF CON 16 video
+ - DEF CON 17 video and slides
+ - DEF CON 18 video and slides
+ - DEF CON 19 video and slides
+ - DEF CON 1 audio
+ - DEF CON 20 video and slides
+ - DEF CON 21 video and slides
+ - DEF CON 22 video and slides
+ - DEF CON 22 wifi village talks
+ - DEF CON 23 video and slides
+ - DEF CON 23 villages video and slides
+ - DEF CON 24 video and slides
+ - DEF CON 25 video and slides
+ - DEF CON 2 audio
+ - DEF CON 3 audio
+ - DEF CON 4 audio
+ - DEF CON 5 audio
+ - DEF CON 6 audio
+ - DEF CON 7 video
+ - DEF CON 8 video
+ - DEF CON 9 video
diff --git a/site.yml b/site.yml
index 204631c..736b2ed 100644
--- a/site.yml
+++ b/site.yml
@@ -10,4 +10,5 @@
- include: clients.yml
- include: dnsserver.yml
- include: torrelay.yml
+- include: bittorrent.yml
- include: update.yml