From f25889523466fa8cfb0011900443561e91ab0790 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 18 Mar 2023 21:00:40 +0100 Subject: [PATCH] add debug for blacklist --- roles/deploy-web/files/blacklist.sh | 9 +++++++-- roles/deploy-web/tasks/configure.yml | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/roles/deploy-web/files/blacklist.sh b/roles/deploy-web/files/blacklist.sh index e93482a..313f262 100755 --- a/roles/deploy-web/files/blacklist.sh +++ b/roles/deploy-web/files/blacklist.sh @@ -47,9 +47,14 @@ do echo ${j} >> ${BLACKLIST} /usr/sbin/iptables -A BLACKLIST -s ${j} -j DROP done - for j in ${list_sender} + for j in ${list_sender[@]} do - scp -i /home/valentin/.ssh-blacklist/id_rsa -P ${SSH} ${BLACKLIST} blacklist_user@${j}:/tmp/blacklist_${IP} + echo "Blacklist envoye a ${j}" >> ${MAIL} + echo "scp -i /home/valentin/.ssh-blacklist/id_rsa -P ${SSH} ${BLACKLIST} blacklist_user@${j}:/tmp/blacklist_${IP}" >> ${MAIL} + scp -i /home/valentin/.ssh-blacklist/id_rsa -P ${SSH} ${BLACKLIST} blacklist_user@${j}:/tmp/blacklist_${IP}i + if [ ${?} -ne 0 ]; then + echo "Error SCP for ${j}" >> ${MAIL} + fi done echo "IP dejà blacklisté : " >> ${MAIL} cat ${BLACKLIST} >> ${MAIL} diff --git a/roles/deploy-web/tasks/configure.yml b/roles/deploy-web/tasks/configure.yml index a55dc8c..cd5f45d 100644 --- a/roles/deploy-web/tasks/configure.yml +++ b/roles/deploy-web/tasks/configure.yml @@ -15,6 +15,11 @@ src: virtualhost.j2 dest: /etc/sentinel/virtualhost mode: "0444" + with_items: + - virtualhost + - ip + - ssh_port + - exclude vars: ansible_become: yes ansible_become_method: sudo