diff --git a/fluentd/fluentd.yml.sh b/fluentd/fluentd.yml.sh new file mode 100644 index 0000000..16f84d1 --- /dev/null +++ b/fluentd/fluentd.yml.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +sudo apt update -y +sudo apt install -y ansible sshpass + +sudo mkdir -p /home/docker/.ansible +sudo chown docker.docker -R /home/docker + +sudo cp files/ansible.cfg /etc/ansible/ansible.cfg + +ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) +ip6=$(/sbin/ip -o -6 addr list eth0 | awk '{print $4}' | cut -d/ -f1) + +echo "[service]" > /project/courses/fluentd/inventory.yml +/project/bin/swarmlab-nmap >> /project/courses/fluentd/inventory.yml + + +# include master or not +echo $ip4 >> /project/courses/fluentd/inventory.yml + + +ansible-playbook -u docker -i inventory.yml fluentd.yml -f 5 --ask-pass --ask-become-pass +# 1st make sudo without password +# run with keys +#ansible-playbook -u docker -i inventory.yml fluentd.yml -f 5 --private-key=/home/docker/.ssh/id_rsa diff --git a/fluentd/inventory.yml b/fluentd/inventory.yml new file mode 100644 index 0000000..1d647c7 --- /dev/null +++ b/fluentd/inventory.yml @@ -0,0 +1,6 @@ +[service] +172.27.0.3 +172.27.0.4 +172.27.0.5 +172.27.0.6 +172.27.0.2