Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #param1 = hostname de la console (devops-VirtualBox)
  4. #param2 = ip de la console (10.0.2.15)
  5.  
  6. #Etre sur que la vm est a jour
  7. apt-get update
  8. apt-get upgrade
  9.  
  10. #Setter le host name de la machine au parametre specifier (param1)
  11. hostnamectl set-hostname $1
  12.  
  13. #Modifier le hosts file
  14. echo "$2 $1" >> /etc/hosts
  15.  
  16. #Installer wget si il nest pas installer
  17. wgetinstalled=`apt-cache policy wget | wc -l`
  18. if [ $wgetinstalled == 0 ]
  19. then
  20. echo "Installing wget..."
  21. apt-get install wget
  22. fi
  23.  
  24.  
  25. #Downloader le package dinstallation de chef server ubuntu
  26. 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
  27.  
  28. #Executer le package dinstallation
  29. dpkg -i /root/chef.deb
  30.  
  31. #Install la console web de chef
  32. chef-server-ctl install chef-manage
  33.  
  34. #reconfigure le server
  35. chef-server-ctl reconfigure --accept-license
  36.  
  37. #reconfigure la console web
  38. chef-manage-ctl reconfigure --accept-license
  39.  
  40.  
  41. #Ici il faut ajouter le user a la console de management
  42. chef-server-ctl user-create chef chef chef chef@chef.com qwerty -f /root/admin.pem
  43.  
  44. #Creer lorganisation ici
  45. chef-server-ctl org-create chef chef --association_user chef -f /root/org.pem
  46.  
  47.  
  48. #Testing
  49. chef-server-ctl test
  50.  
  51.  
  52. echo "You can connect to the web console at : http://$2 with the credentials : username:chef password:qwerty "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement