Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #param1 = hostname de la console (devops-VirtualBox)
- #param2 = ip de la console (10.0.2.15)
- #Etre sur que la vm est a jour
- apt-get update
- apt-get upgrade
- #Setter le host name de la machine au parametre specifier (param1)
- hostnamectl set-hostname $1
- #Modifier le hosts file
- echo "$2 $1" >> /etc/hosts
- #Installer wget si il nest pas installer
- wgetinstalled=`apt-cache policy wget | wc -l`
- if [ $wgetinstalled == 0 ]
- then
- echo "Installing wget..."
- apt-get install wget
- fi
- distro=`head -n 1 /etc/os-release | cut -d "=" -f 2`
- if [[ $distro == *"Ubuntu"* ]]; then
- #Executer ca si on est sur Ubuntu
- #Downloader le package dinstallation de chef server ubuntu
- wget https://packages.chef.io/files/stable/chef-server/12.15.7/ubuntu/16.04/chef-server-core_12.15.7-1_amd64.deb -O /root/chef.deb
- #Executer le package dinstallation
- dpkg -i /root/chef.deb
- ####################################
- elif [[ $distro == *"CentOS"* ]]; then
- #Executer ca si on est sur Centos 7
- #Downloader le package dinstallation de chef server centos 7
- wget https://packages.chef.io/files/stable/chef-server/12.15.7/el/7/chef-server-core-12.15.7-1.el7.x86_64.rpm -O /root/chef.rpm
- #Executer le package dinstallation
- rpm -i /root/chef.rpm
- ####################################
- fi
- #Install la console web de chef
- chef-server-ctl install chef-manage
- #reconfigure le server
- chef-server-ctl reconfigure --accept-license
- #reconfigure la console web
- chef-manage-ctl reconfigure --accept-license
- #Ici il faut ajouter le user a la console de management
- chef-server-ctl user-create chef chef chef chef@chef.com qwerty -f /root/admin.pem
- #Creer lorganisation ici
- chef-server-ctl org-create chef chef --association_user chef -f /root/org.pem
- #Testing
- chef-server-ctl test
- echo "You can connect to the web console at : http://$2 with the credentials : username:chef password:qwerty "
Add Comment
Please, Sign In to add comment