You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1002 B

3 years ago
#!/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
3 years ago
#master ip
3 years ago
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)
3 years ago
#workers ip
3 years ago
echo "[service]" > /project/courses/Thesis/inventory.yml
3 years ago
# /project/bin/swarmlab-nmap >> /project/courses/Thesis/inventory.yml
3 years ago
# include master or not
3 years ago
echo $ip4 >> /project/courses/Thesis/inventory.yml
3 years ago
3 years ago
#dummy
ansible-playbook -u docker -i inventory.yml node.yml -f 5 --ask-pass --ask-become-pass
#mongo
# ansible-playbook -u docker -i inventory.yml mongo.yml -f 5 --ask-pass --ask-become-pass
3 years ago
# 1st make sudo without password
# run with keys
3 years ago
#ansible-playbook -u docker -i inventory.yml fluentd.yml -f 5 --private-key=/home/docker/.ssh/id_rsa
#get workers ip
#nmap -sn -oG - $ip/24 | grep Up | grep $NODENETWORK | cut -d ' ' -f 2