Move node bootstrap to ansible

This commit is contained in:
Aleksandr Didenko 2016-07-08 18:49:41 +02:00
parent 6a287973d9
commit a5a34c98a5
5 changed files with 22 additions and 29 deletions

6
Vagrantfile vendored
View file

@ -109,12 +109,6 @@ Vagrant.configure("2") do |config|
config.vm.provision "file", source: "ssh", destination: "~/ssh"
if master
config.vm.provision "nodes", type: "file", source: "nodes", destination: "/var/tmp/nodes"
config.vm.provision "microservices", type: "file",
source: "ccp/microservices",
destination: "/var/tmp/microservices"
config.vm.provision "microservices-repos", type: "file",
source: "ccp/microservices-repos",
destination: "/var/tmp/microservices-repos"
config.vm.provision "bootstrap", type: "shell", path: "vagrant-scripts/provision-master.sh"
else
config.vm.provision "bootstrap", type: "shell", path: "vagrant-scripts/provision-node.sh"

View file

@ -2,15 +2,10 @@
INVENTORY="nodes_to_inv.py"
nodes=""
i=1
for nodeip in `cat nodes` ; do
i=$(( $i+1 ))
nodes+=" node${i}[ansible_ssh_host=${nodeip},ip=${nodeip}]"
done
echo "Installing requirements on nodes..."
ansible-playbook -i $INVENTORY playbooks/bootstrap-nodes.yaml
echo "Running deployment..."
#kargo deploy -y --ansible-opts="-e @custom.yaml"
ansible-playbook -i $INVENTORY /root/kargo/cluster.yml -e @custom.yaml
deploy_res=$?

View file

@ -0,0 +1,18 @@
- hosts: all
tasks:
- name: Install packages
package: name={{ item }} state=latest
with_items:
- python
- python-pip
- screen
- vim
- telnet
- tcpdump
- traceroute
- iperf3
- nmap
- ethtool
- curl
- git
- dnsutils

View file

@ -1,10 +1,10 @@
#!/bin/bash
echo master > /var/tmp/role
# Some debug tools
# Packages
sudo apt-get --yes update
sudo apt-get --yes upgrade
sudo apt-get --yes install screen vim telnet tcpdump python-pip traceroute iperf3 nmap ethtool curl git dnsutils
sudo apt-get --yes install screen git
# SSH keys and config
sudo rm -rf /root/.ssh
@ -12,5 +12,3 @@ sudo mv ~vagrant/ssh /root/.ssh
sudo echo -e 'Host 10.*\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null' >> /root/.ssh/config
sudo chown -R root: /root/.ssh
# README
sudo echo 'cd /root/kargo ; ansible-playbook -vvv -i inv/inventory.cfg cluster.yml -u root -f 7' > /root/README

View file

@ -1,21 +1,9 @@
#!/bin/bash
echo node > /var/tmp/role
# Some debug tools
sudo apt-get --yes update
sudo apt-get --yes upgrade
sudo apt-get --yes install screen vim telnet tcpdump python-pip traceroute iperf3 nmap ethtool curl git dnsutils
# SSH
sudo rm -rf /root/.ssh
sudo mv ~vagrant/ssh /root/.ssh
sudo rm -f /root/.ssh/id_rsa*
sudo chown -R root: /root/.ssh
# DISABLED: switched to new box which has 100G / partition
# Setup new drive for docker
#sudo mkfs.ext4 /dev/vdb
#sudo mkdir -p /var/lib/docker
#sudo echo '/dev/vdb /var/lib/docker ext4 defaults,noatime,nodiratime 0 0' >> /etc/fstab
#sudo mount -a